Skip to content

Instantly share code, notes, and snippets.

View LinZap's full-sized avatar
🔬
copilot

Zap LinZap

🔬
copilot
View GitHub Profile
[
{
"Name": "AddressWidth",
"Value": 64,
"Type": 18,
"IsLocal": true,
"IsArray": false,
"Origin": "CIM_Processor",
"Qualifiers": [
{
-- 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)
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)
@LinZap
LinZap / hk6.cs
Last active March 16, 2018 03:38
[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
{
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 指令
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 指令
@LinZap
LinZap / hc1.cs
Last active March 15, 2018 09:47
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 指令
@LinZap
LinZap / hk4.cs
Last active March 15, 2018 07:24
[HttpDelete]
public object sum([FromBody]AddModel body)
{
return new { sum = body.a + body.b };
}
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;
}
public class AddController : ApiController
{
[HttpGet]
public object sum(int a, int b)
{
return new { sum = a + b };
}
}