G
Guest
i am trying to add a new row in a sql server 2005 that has an id of type
uniqueidentifier using this piece of code:
thecommand = new System.Data.SqlClient.SqlCommand();
thecommand.Connection=thecon;
thecommand.CommandText="INSERT INTO
users(ID,uname,username,password,description,persettings) VALUES(
@ID,'Administrator','Administrator',@pwd,'The administrator of the
timokatalogos database','')";
thecommand.Parameters.Add("@ID",System.Data.SqlDbType.UniqueIdentifier);
thecommand.Parameters.Add("@pwd",System.Data.SqlDbType.NVarChar);
thecommand.Parameters["@ID"].Value=System.Guid.NewGuid();
thecommand.Parameters["@pwd"].Value=pwd;
thecommand.ExecuteNonQuery();
and i get na error: "String or binary data would be truncated. the statement
has been terminated", then i try to create the row directly from SQL Server
Management Studio and i copy a GUID created from visual studio in the id
field and i get the same error that the messagebox tells that is generated
from the .net sql data provider. Anybody knows anything about it?
thanks in advance
uniqueidentifier using this piece of code:
thecommand = new System.Data.SqlClient.SqlCommand();
thecommand.Connection=thecon;
thecommand.CommandText="INSERT INTO
users(ID,uname,username,password,description,persettings) VALUES(
@ID,'Administrator','Administrator',@pwd,'The administrator of the
timokatalogos database','')";
thecommand.Parameters.Add("@ID",System.Data.SqlDbType.UniqueIdentifier);
thecommand.Parameters.Add("@pwd",System.Data.SqlDbType.NVarChar);
thecommand.Parameters["@ID"].Value=System.Guid.NewGuid();
thecommand.Parameters["@pwd"].Value=pwd;
thecommand.ExecuteNonQuery();
and i get na error: "String or binary data would be truncated. the statement
has been terminated", then i try to create the row directly from SQL Server
Management Studio and i copy a GUID created from visual studio in the id
field and i get the same error that the messagebox tells that is generated
from the .net sql data provider. Anybody knows anything about it?
thanks in advance