This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Name": "AddressWidth", | |
"Value": 64, | |
"Type": 18, | |
"IsLocal": true, | |
"IsArray": false, | |
"Origin": "CIM_Processor", | |
"Qualifiers": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I3S Tech Homework Lv.1 | |
-- By Zap | |
------ My Split Function --------------------------------------------------------- | |
create function fn_split(@str nvarchar(max),@separator nvarchar(max)) | |
returns @splits table(segment nvarchar(max)) | |
as | |
begin | |
declare @anchor int=CHARINDEX(@separator,@str),@gram int=len(@separator) | |
while @anchor>0 and @gram<=len(@str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create function fn_split(@str nvarchar(max),@separator as nvarchar(max)) | |
returns @splits table(segment nvarchar(max)) | |
as | |
begin | |
declare @anchor int=CHARINDEX(@separator,@str),@gram int=len(@separator) | |
while @anchor>0 and @gram<=len(@str) | |
begin | |
insert into @splits values(SUBSTRING(@str, 1, @anchor-1)) | |
set @str=SUBSTRING(@str,@anchor+@gram,len(@str)-@anchor+@gram+1) | |
set @anchor=CHARINDEX(@separator,@str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public HttpResponseMessage insertEntity([FromBody]ModelAddEntity body) | |
{ | |
SQL db = new SQL(); | |
string sql = @" declare @ids table(id int); | |
insert into Entity(cname,ename,borel) output inserted.eid into @ids | |
values(@cname,@ename,@borel); | |
select id from @ids;"; | |
var para = new | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage getEntity(int eid) { | |
// 開啟連線 | |
SqlConnection conn = new SqlConnection("Server=192.168.1.190;Database=TestFpage;User ID=apitester;Password=Iq123456"); | |
conn.Open(); | |
// SQL 指令 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage getEntity(int eid) { | |
// 開啟連線 | |
SqlConnection conn = new SqlConnection("Server=192.168.1.190;Database=TestFpage;User ID=apitester;Password=Iq123456"); | |
conn.Open(); | |
// SQL 指令 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage getEntity() { | |
// 開啟連線 | |
SqlConnection conn = new SqlConnection("Server=192.168.1.190;Database=TestFpage;User ID=apitester;Password=Iq123456"); | |
conn.Open(); | |
// SQL 指令 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpDelete] | |
public object sum([FromBody]AddModel body) | |
{ | |
return new { sum = body.a + body.b }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage getImg() { | |
string ImgPath = @"D:\CSharp\MyWebAPI\MyWebAPI\App_Data\123.jpg"; | |
var resp = new HttpResponseMessage(); | |
resp.Content = new StreamContent(File.OpenRead(ImgPath)); | |
resp.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg"); | |
return resp; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddController : ApiController | |
{ | |
[HttpGet] | |
public object sum(int a, int b) | |
{ | |
return new { sum = a + b }; | |
} | |
} |