Cmd=new SqlCommand("Insert into Customers(CustomerId)"+"values(@Count)",MyConn);
Cmd.Parameters.Add("@Count",SqlDbtype.NvarChar,15);
Myda.InsertCommand=Cmd
请问一下
Cmd.Parameters.Add("@Count",SqlDbtype.NvarChar,15);这句是什么意思
其中@Count,是设置变量的值大小还是什么,希望高手能够详细的帮我讲解一下!
谢谢!
Cmd.Parameters.Add("@Count",SqlDbtype.NvarChar,15);
Myda.InsertCommand=Cmd
请问一下
Cmd.Parameters.Add("@Count",SqlDbtype.NvarChar,15);这句是什么意思
其中@Count,是设置变量的值大小还是什么,希望高手能够详细的帮我讲解一下!
谢谢!
添加一个参数,类型为SqlDbtype.NvarChar
长度为:15
Insert into Customers(CustomerId) values(@Count) 语句
的参数
Cmd.Parameters.Add("@Count",SqlDbtype.NvarChar,15);
的意思是向cmd声明这个sql变量的长度和类型
参数的值是 你程序中的变量Count的值.
参数的类型是 NvarChar, 大小15 byte
>>Cmd=new SqlCommand("Insert into Customers(CustomerId)"+"values(@Count)",MyConn);
根据这句可以推断, Count 是作为CoustomerId 来使用的. 程序每次会有一个递增的操作
Count ++; 或 Count = Count + 1;