create database DB;
複製代碼
值得一提的是,mysql中bool類型用tinyint(1)來表示,1是真,0是假mysql
create table Class
(
Id int primary key auto_increment,
Name varchar(20) not null,
);
create table UserInfo
(
Id int primary key auto_increment,
Name varchar(20) not null,
Sex tinyint(1) default'0',
ClassId int,
foreign key (ClassId) references Class(Id)
);
複製代碼
insert into Class (Name) values ('1709A');
insert into UserInfo (Name,Sex,ClassId)values('張三',1,1)
複製代碼
delete from UserInfo ;
delete from UserInfo where Id =1;
複製代碼
select * from UserInfo
select a.`Name`,b.`Name` from UserInfo a inner join Class b on a.ClassId=b.Id
複製代碼
update UserInfo set Name='李四' where Id =1;
update UserInfo set Name='李四',Sex=0 where Id =1;
複製代碼
"Database=BookDB;Data Source=localhost;User Id=root;Password=******;charset='utf8';pooling=true"web
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
<add name="HttpSoap"/>
<add name="Documentation"/>
</protocols>
</webServices>
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/>
<add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/>
<add name="Access-Control-Allow-Origin" value="*"/>
</customHeaders>
</httpProtocol>
</system.webServer>
複製代碼
**ajax
若要容許使用 ASP.NET AJAX 從腳本中調用此 Web 服務,請取消對下行的註釋。 [System.Web.Script.Services.ScriptService]sql
$.ajax({
url: ''
, type: 'post ,contentType: "application/json;utf-8" ,dataType:'json' , success: function (d) { console.log(d) } }) 複製代碼