[Mono-dev] SqlDataAdapter Update Problem

T Senganal tsenganal at novell.com
Thu Jan 12 10:01:59 EST 2006


Hi 

This is a bug.. Please file a bug report on System.Data Component..

Senga

>>> "Scaramella Luca" <sluca at hotmail.com> 1/12/2006 5:19 pm >>>
Hi everybody,
I'm using Mono 1.1.13.
Adding multiple records to a tables i've got the following error.
The thing i don't understand is why if i add 1 record everything goes
Ok ??
The problem seems to be the Update method when i insert more than 1
row.
The code i use is like this
-----------------------------------------------------------------------------------------------------------------------------
	DataSet dsSql = new DataSet();
	tblDa = new SqlDataAdapter("SELECT * FROM
test",Test.Gcon_ConnectLDB);

	SqlCommandBuilder cb = new SqlCommandBuilder(tblDa);
	tblDa.Fill(dsSql,"test");

	row_rsInput = dsSql.Tables[0].NewRow();

	row_rsInput["tmp01_idcard"] = "1111";
	row_rsInput["tmp01_iduser"] = "111";

	dsSql.Tables[0].Rows.Add(row_rsInput);

	row_rsInput = dsSql.Tables[0].NewRow();


	row_rsInput["tmp01_idcard"] = "2222";
	row_rsInput["tmp01_iduser"] = "222";

	dsSql.Tables[0].Rows.Add(row_rsInput);

	tblDa.Update(dsSql,"test");

--------------------------------------------------------------------------------------



System.Data.SqlClient.SqlException: The variable name '@p1' has already
been 
declared. Variable names must be unique within a query batch or stored

procedure.
in <0x000a0> System.Data.SqlClient.SqlConnection:ErrorHandler
(System.Object 
sender, Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
in (wrapper delegate-invoke) 
System.MulticastDelegate:invoke_void_object_TdsInternalErrorMessageEventArgs

(object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in <0x0001d> Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage 
(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
in <0x001aa> Mono.Data.Tds.Protocol.Tds:ProcessMessage
(TdsPacketSubType 
subType)
in <0x0010e> Mono.Data.Tds.Protocol.Tds:ProcessSubPacket ()
in <0x00045> Mono.Data.Tds.Protocol.Tds:NextResult ()
in <0x0004b> System.Data.SqlClient.SqlDataReader:NextResult ()
in (wrapper remoting-invoke-with-check) 
System.Data.SqlClient.SqlDataReader:NextResult ()
in <0x0007f> System.Data.SqlClient.SqlDataReader:.ctor 
(System.Data.SqlClient.SqlCommand command)
in (wrapper remoting-invoke-with-check) 
System.Data.SqlClient.SqlDataReader:.ctor
(System.Data.SqlClient.SqlCommand)
in <0x00061> System.Data.SqlClient.SqlCommand:ExecuteReader
(CommandBehavior 
behavior)


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list