Click here to Skip to main content
15,914,289 members
Home / Discussions / Database
   

Database

 
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 
GeneralRe: Datagrid Pin
kornstyle14-Aug-03 9:37
kornstyle14-Aug-03 9:37 
GeneralRe: Datagrid Pin
kornstyle14-Aug-03 9:43
kornstyle14-Aug-03 9:43 
QuestionNETTable creation through ADO.NET? Pin
Dr Herbie14-Aug-03 5:55
Dr Herbie14-Aug-03 5:55 
AnswerRe: NETTable creation through ADO.NET? Pin
Marcel Härry25-Aug-03 11:48
Marcel Härry25-Aug-03 11:48 
GeneralRe: NETTable creation through ADO.NET? Pin
Dr Herbie26-Aug-03 9:27
Dr Herbie26-Aug-03 9:27 
QuestionRobust Tool for creating Excel Spreadsheets from Oracle tables? Pin
dratti14-Aug-03 3:51
dratti14-Aug-03 3:51 
AnswerRe: Robust Tool for creating Excel Spreadsheets from Oracle tables? Pin
Markk14-Aug-03 8:51
Markk14-Aug-03 8:51 
GeneralRe: Robust Tool for creating Excel Spreadsheets from Oracle tables? Pin
dratti14-Aug-03 9:05
dratti14-Aug-03 9:05 
QuestionSQL Server 2000 Enterprise Manager? Pin
Jason Weibel13-Aug-03 11:29
Jason Weibel13-Aug-03 11:29 
AnswerRe: SQL Server 2000 Enterprise Manager? Pin
Arjan Einbu13-Aug-03 12:02
Arjan Einbu13-Aug-03 12:02 
GeneralRe: SQL Server 2000 Enterprise Manager? Pin
Jason Weibel14-Aug-03 2:35
Jason Weibel14-Aug-03 2:35 
Generalquestion about collection Pin
yyf13-Aug-03 6:01
yyf13-Aug-03 6:01 
GeneralRe: question about collection Pin
jeff_martin13-Aug-03 7:29
jeff_martin13-Aug-03 7:29 

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.