Hi,
I'm using a data adapter daReadAdmin which is delcared like this:
SqlDataAdapter daReadAdmin = new SqlDataAdapter("p_ReadAdmin",
strConnection);
Where p_ReadAdmin is a parametrized Stored procedure in SQL Server then the
following code states:
daReadAdmin.SelectCommand.CommandText = "p_ReadAdmin";
daReadAdmin.SelectCommand.CommandType = CommandType.StoredProcedure;
After this i set the parameters:
daTimeRecording.SelectCommand.Parameters.Add("@EmployeeID",
SqlDbType.UniqueIdentifier,0,cboName.SelectedValue.ToString());
daReadAdmin.SelectCommand.Parameters.Add("@TRDate", dtpDate.Value);
Then the DataSet must be filled:
daReadAdmin.Fill(dsReadAdmin, "p_ReadAdmin");
Then use a DataView:
dvdgTimeRecording = new DataView(dsReadAdmin.Tables["p_ReadAdmin"]);
dgTimeRecording.DataSource = dvdgTimeRecording;
The Result..: "An unhandled exception of type
'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional
information: System error."
the exception shows on the line "daReadAdmin.Fill(dsReadAdmin,
"p_ReadAdmin");
I think the problem is on passing parameter for @EmployeeID which should be
given by cboName.SelectedValue. EmployeeID is a GUID. If I modify the sp on
SQL to recieve only @TRDate as parameter then everything works fine. How
should I add the GUID Parameter?
thx.
Gis - 12 Nov 2004 12:14 GMT
I'm VERY VERY SORRY!!! I found the mistake... I was calling another
dataadapter when adding EmployeeID parameter..
thx!
> Hi,
> I'm using a data adapter daReadAdmin which is delcared like this:
[quoted text clipped - 32 lines]
> should I add the GUID Parameter?
> thx.