Click here to Skip to main content
15,924,679 members
Home / Discussions / Database
   

Database

 
GeneralRe: Too Complex For Me...Maybe You? Pin
jesus4u18-Aug-03 10:04
jesus4u18-Aug-03 10:04 
GeneralRe: Too Complex For Me...Maybe You? Pin
basementman18-Aug-03 10:08
basementman18-Aug-03 10:08 
GeneralRetrieving PF, FK from table Pin
SimonS18-Aug-03 7:32
SimonS18-Aug-03 7:32 
GeneralRe: Retrieving PF, FK from table Pin
basementman18-Aug-03 10:06
basementman18-Aug-03 10:06 
GeneralRe: Retrieving PF, FK from table Pin
RichardGrimmer19-Aug-03 5:25
RichardGrimmer19-Aug-03 5:25 
GeneralRe: Retrieving PF, FK from table Pin
SimonS19-Aug-03 10:42
SimonS19-Aug-03 10:42 
QuestionEver needed to Increment a Revision? Pin
OMalleyW18-Aug-03 4:29
OMalleyW18-Aug-03 4:29 
AnswerRe: Ever needed to Increment a Revision? Pin
OMalleyW18-Aug-03 5:23
OMalleyW18-Aug-03 5:23 
QuestionMD5 in SQL Server 2000? Pin
Abin18-Aug-03 0:19
Abin18-Aug-03 0:19 
AnswerRe: MD5 in SQL Server 2000? Pin
Mike Dimmick19-Aug-03 5:02
Mike Dimmick19-Aug-03 5:02 
GeneralADO :VARIANY :Binarry Array Pin
Fad B17-Aug-03 21:52
Fad B17-Aug-03 21:52 
GeneralNoob sql Pin
Snyp17-Aug-03 4:59
Snyp17-Aug-03 4:59 
GeneralRe: Noob sql Pin
Rein Hillmann17-Aug-03 21:24
Rein Hillmann17-Aug-03 21:24 
GeneralRe: Noob sql Pin
Jeremy Oldham18-Aug-03 2:12
Jeremy Oldham18-Aug-03 2:12 
GeneralRe: Noob sql Pin
Snyp18-Aug-03 3:10
Snyp18-Aug-03 3:10 
GeneralPrimaryKey problem Pin
Hovik Melkomian17-Aug-03 3:03
Hovik Melkomian17-Aug-03 3:03 
GeneralC# - Help with preferred method to add a new row Pin
work_to_live16-Aug-03 13:05
work_to_live16-Aug-03 13:05 
GeneralRe: C# - Help with preferred method to add a new row Pin
work_to_live16-Aug-03 13:50
work_to_live16-Aug-03 13:50 
GeneraldataSet row position Pin
Hovik Melkomian16-Aug-03 5:52
Hovik Melkomian16-Aug-03 5:52 
GeneralDEPLOYMENT Pin
eggie515-Aug-03 22:56
eggie515-Aug-03 22:56 
GeneralDatagrid Pin
kornstyle14-Aug-03 7:31
kornstyle14-Aug-03 7:31 
How can I Update more than two columns. Everytime I try to update more than two I get a syntax error. Can somebody help me. This code gave me the syntax error.


private void datagrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int ID = (int) datagrid.DataKeys[(int) e.Item.ItemIndex];

string name = ((TextBox)e.Item.Cells[1].Controls[0]).Text;
string type = ((TextBox)e.Item.Cells[2].Controls[0]).Text;
string test = ((TextBox)e.Item.Cells[3].Controls[0]).Text;


string sql =
"UPDATE EmployeeInfo SET Fir=\"" + name +
"\", Las=\"" + type + "\"" +
"\", Res=\"" +test+ "\""
"WHERE ID=" + ID;

ExecuteNonQuery(sql);

datagrid.EditItemIndex = -1;
ReadRecords();

}


The code does not give the syntax error but only updates the two columns.


private void datagrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int ID = (int) datagrid.DataKeys[(int) e.Item.ItemIndex];

string name = ((TextBox)e.Item.Cells[1].Controls[0]).Text;
string type = ((TextBox)e.Item.Cells[2].Controls[0]).Text;


string sql =
"UPDATE EmployeeInfo SET Fir=\"" + name +
"\", Las=\"" + type + "\"" +

" WHERE ID=" + ID;
ExecuteNonQuery(sql);

datagrid.EditItemIndex = -1;
ReadRecords();

}

Can anyone give some pointers. Thanks

GeneralRe: Datagrid Pin
Jeff Martin14-Aug-03 7:53
Jeff Martin14-Aug-03 7:53 
GeneralRe: Datagrid Pin
kornstyle14-Aug-03 8:08
kornstyle14-Aug-03 8:08 
GeneralRe: Datagrid Pin
kornstyle14-Aug-03 8:10
kornstyle14-Aug-03 8:10 
GeneralRe: Datagrid Pin
Jeff Martin14-Aug-03 9:26
Jeff Martin14-Aug-03 9:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.