Showing posts with label updation. Show all posts
Showing posts with label updation. Show all posts

Sunday, March 11, 2012

DataGrid updation problem !

Hello all
i am trying to update the database with the DataSet (Updated from the DataGrid) but it is giving the error as
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
the code is as follows


public DataSet bindControlToGrid(DataSet dataSet)
{
SqlConnection objConn= null;
SqlCommand objComm = null;
try
{
objConn = new SqlConnection(@."User ID=sa;Password=sa;database=ExtraNet;server=EAGLES\EAGLES");

SqlDataAdapter objAdapter=new SqlDataAdapter();
objAdapter.SelectCommand= new SqlCommand("SELECT sUserID,sUserName FROM tblUser WHERE dUserDeActivated IS NULL ORDER BY sUserName,nUsrSerialNo",objConn);
SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(objAdapter);
objConn.Open();
DataSet objdataSet= new DataSet("ko");
string d = (dataSet.Tables[0].Rows[0].ItemArray.GetValue(0).ToString());

objAdapter.Fill(objdataSet);
objAdapter.Update(dataSet);
objAdapter.Dispose();
}
catch(Exception ex)
{
string s= ex.Message;
}
finally
{
//objComm.Dispose();
objConn.Close();
}
return dataSet;
}


kindly helpGot The Answere

sUserID was not declared as primary ker

Thanks all

Tuesday, February 14, 2012

database updation log

how could I see which user run what query on the datbase
(sql 2000) at what time. pl help
regards, shahidYou need to have a trace running at that point-in-time, to see what the
users were running at that time. Do you have one?
Or you need to have some sort of logging in your application or stored
procedures.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"shahid" <anonymous@.discussions.microsoft.com> wrote in message
news:2b13201c467fb$a8013480$a401280a@.phx
.gbl...
how could I see which user run what query on the datbase
(sql 2000) at what time. pl help
regards, shahid|||Hi,
SQL Server will not log any Select statements. Only way to look into that is
activate Profiler. You can save the profiler output to a Table for analysis.
FYI, You can see the information only from the point you activate the
profier.
For doing this you could use the GUI interface Profiler or look into the
books online for the procedure "sp_trace_create".
Thanks
Hari
MCDBA
"shahid" <anonymous@.discussions.microsoft.com> wrote in message
news:2b13201c467fb$a8013480$a401280a@.phx
.gbl...
> how could I see which user run what query on the datbase
> (sql 2000) at what time. pl help
> regards, shahid