如何将Guid读入sqlserver的uniqueidentifier字段里去
来源:互联网 发布:java double 误差 编辑:程序博客网 时间:2024/05/04 11:34
在SQL server northwind建立表Test
cola varchar 50
colb uniqueidentifier 16
页面文件中:
string str;
str = @"server=localhost;uid=sa;pwd=sa;database=northwind";
SqlConnection cn = new SqlConnection(str);
str = "INSERT INTO Test(cola, colb) Values (@a, @b)";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.Parameters.Add("@a",SqlDbType.VarChar).Value = "aa";
cmd.Parameters.Add("@b",SqlDbType.UniqueIdentifier).Value = new Guid(System.Guid.NewGuid().ToString());
cn.Open();
int i = cmd.ExecuteNonQuery();
if (i != 0)
Response.Write ("操作查询已执行");
cn.Close();
cola varchar 50
colb uniqueidentifier 16
页面文件中:
string str;
str = @"server=localhost;uid=sa;pwd=sa;database=northwind";
SqlConnection cn = new SqlConnection(str);
str = "INSERT INTO Test(cola, colb) Values (@a, @b)";
SqlCommand cmd = new SqlCommand(str, cn);
cmd.Parameters.Add("@a",SqlDbType.VarChar).Value = "aa";
cmd.Parameters.Add("@b",SqlDbType.UniqueIdentifier).Value = new Guid(System.Guid.NewGuid().ToString());
cn.Open();
int i = cmd.ExecuteNonQuery();
if (i != 0)
Response.Write ("操作查询已执行");
cn.Close();
- 如何将Guid读入sqlserver的uniqueidentifier字段里去
- sqlserver uniqueidentifier 字段值自动填充语句
- 如何将mysql的数据导到mssql里去
- SQLSERVER更新日期字段里的一部分
- 将一个文本里的信息,读入到 list 中
- SQLServer中如何将一个字段的多个记录值合在一行显示
- SqlServer中的数据类型UniqueIdentifier
- SQLServer中的uniqueidentifier类型
- SqlServer中的数据类型UniqueIdentifier
- SQLServer "uniqueidentifier" 类型
- 如何使用SQL的UNIQUEIDENTIFIER数据类型
- Matlab如何读入指定文件夹里的所有图片
- Sqlserver中如何将字符串字段类似SUM输出
- 在SQL数据库中设定uniqueidentifier类型的值为Guid.Empty的做法
- 将csv文件读入到数组里
- 在SQL Server中怎么得到全为零的GUID(uniqueidentifier)
- C#中如何将打开的TXT文件读入RichTextBox
- VB.NET如何将几百兆甚至1G以上的文件存入ORACLE的BLOB字段里面去!
- NHibernate 系列研究
- asp.net cache
- Linux操作系统下利用SSH进行远程控制
- SqlServer中的数据类型UniqueIdentifier
- 处理html元素消息( from MSDN)
- 如何将Guid读入sqlserver的uniqueidentifier字段里去
- 另外一个不错的弹出层的js效果
- oracle递归语句
- 使用C#工程里的资源文件
- [MSDN]跟我一起学Visual Studio 2005系列课程 之一 C# 语法篇
- 使用features.conf的applicationmap自定义功能健
- AIX操作系统下应用系统的维护与性能优化
- windows 2000/xp/2003开机后的密码登录界面的取消【基本常识】
- 我们是怎样的一代人?