Click here to Skip to main content
15,917,062 members
Home / Discussions / C#
   

C#

 
GeneralRe: Capturing a perticular part of an Image Pin
Stephane David8-Apr-04 20:27
Stephane David8-Apr-04 20:27 
QuestionHow to parse a SQL string? Pin
Nguyen Vu Cuong7-Apr-04 0:34
Nguyen Vu Cuong7-Apr-04 0:34 
GeneralCast Problem Pin
Jochen Jonckheere7-Apr-04 0:28
Jochen Jonckheere7-Apr-04 0:28 
GeneralRe: Cast Problem Pin
Bill Dean7-Apr-04 1:44
Bill Dean7-Apr-04 1:44 
QuestionHow to delete file on client side using remote object Pin
dephlocus6-Apr-04 23:54
dephlocus6-Apr-04 23:54 
AnswerRe: How to delete file on client side using remote object Pin
Judah Gabriel Himango7-Apr-04 4:06
sponsorJudah Gabriel Himango7-Apr-04 4:06 
GeneralMem Usage Pin
DougW486-Apr-04 23:25
DougW486-Apr-04 23:25 
GeneralRe: Mem Usage Pin
Dave Kreskowiak7-Apr-04 1:35
mveDave Kreskowiak7-Apr-04 1:35 
GeneralRe: Mem Usage Pin
DougW487-Apr-04 1:43
DougW487-Apr-04 1:43 
GeneralRe: Mem Usage Pin
Heath Stewart7-Apr-04 6:13
protectorHeath Stewart7-Apr-04 6:13 
GeneralUserControl and interface implementation Pin
Corneliu Tusnea6-Apr-04 22:28
Corneliu Tusnea6-Apr-04 22:28 
GeneralRe: UserControl and interface implementation Pin
Heath Stewart7-Apr-04 5:46
protectorHeath Stewart7-Apr-04 5:46 
GeneralRe: UserControl and interface implementation Pin
Corneliu Tusnea7-Apr-04 13:26
Corneliu Tusnea7-Apr-04 13:26 
Generaluneable to update an Access database Pin
michael.wikstrom6-Apr-04 22:14
michael.wikstrom6-Apr-04 22:14 
GeneralRe: uneable to update an Access database Pin
Heath Stewart7-Apr-04 4:49
protectorHeath Stewart7-Apr-04 4:49 
The way you're doing it is not optimal and often leads to problems because certain characters - like quotes - are not escaped properly. See the documentation for the OleDbParameter class and use a paramterized query like so:
OleDbCommand cmd = myConnection.CreateCommand();
cmd.CommandText = "UPDATE userinfo SET Password=? WHERE " +
  "Name=? AND Password=?";
cmd.Parameters.Add("NewPassword", OleDbType.VarWChar, 40).Value = newPassword;
cmd.Parameters.Add("Name", OleDbType.VarWChar, 40).Value = user.Name;
cmd.Parameters.Add("OlePassword", OleDbType.VarWChar, 40).Value = oldPassword;
int i = cmd.ExecuteNonQuery();
Console.WriteLine("{0} record(s) modified", i);
The OLE DB provider for ADO.NET does not use named parameters, and instead uses positional parameters using the question mark, so you must add your parameters in the same order. The example aboves assumes you declare your fields as Text using 40 characters as the length. This is just an example, though, so read the documentation for the OleDbParameter for more information.

 

Microsoft MVP, Visual C#
My Articles
GeneralAutomailer Pin
sreejith ss nair6-Apr-04 19:54
sreejith ss nair6-Apr-04 19:54 
GeneralRe: Automailer Pin
Dave Kreskowiak7-Apr-04 1:43
mveDave Kreskowiak7-Apr-04 1:43 
QuestionHow to get the IP of SqlServer? Pin
Member 6449646-Apr-04 19:53
Member 6449646-Apr-04 19:53 
AnswerRe: How to get the IP of SqlServer? Pin
Colin Angus Mackay7-Apr-04 0:12
Colin Angus Mackay7-Apr-04 0:12 
GeneralRe: How to get the IP of SqlServer? Pin
Member 6449647-Apr-04 15:58
Member 6449647-Apr-04 15:58 
GeneralRe: How to get the IP of SqlServer? Pin
Dave Kreskowiak8-Apr-04 3:06
mveDave Kreskowiak8-Apr-04 3:06 
AnswerRe: How to get the IP of SqlServer? Pin
Heath Stewart7-Apr-04 4:42
protectorHeath Stewart7-Apr-04 4:42 
GeneralRe: How to get the IP of SqlServer? Pin
Member 6449647-Apr-04 16:00
Member 6449647-Apr-04 16:00 
GeneralDatagrid Record Numbering Pin
sreejith ss nair6-Apr-04 19:49
sreejith ss nair6-Apr-04 19:49 
GeneralRe: Datagrid Record Numbering Pin
Heath Stewart7-Apr-04 3:52
protectorHeath Stewart7-Apr-04 3:52 

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.