Click here to Skip to main content
15,921,840 members
Home / Discussions / Database
   

Database

 
GeneralRe: MsSQL Newbie Questions Pin
Colin Angus Mackay15-Dec-03 22:28
Colin Angus Mackay15-Dec-03 22:28 
GeneralExecute Pin
Anonymous15-Dec-03 7:53
Anonymous15-Dec-03 7:53 
GeneralBaby steps to .net Pin
crderrick11-Dec-03 1:52
crderrick11-Dec-03 1:52 
GeneralADO .NET and MFC Pin
Late11-Dec-03 1:15
Late11-Dec-03 1:15 
GeneralCreate multi-page report! Pin
Anonymous10-Dec-03 17:27
Anonymous10-Dec-03 17:27 
QuestionClear Table in a Dataset Containing Multiple Tables - How? Pin
CharlieMay10-Dec-03 16:31
CharlieMay10-Dec-03 16:31 
GeneralRe: :: problem in UPDATE statement :: Pin
Colin Angus Mackay11-Dec-03 15:45
Colin Angus Mackay11-Dec-03 15:45 
GeneralRe: :: problem in UPDATE statement :: Pin
Colin Angus Mackay12-Dec-03 12:06
Colin Angus Mackay12-Dec-03 12:06 
Okay, I've got the files you sent me. So that everyone else understands what is happening I'll explain a little about what was sent.

I received a database with a table called "tsttbl", that table contained a field called "value". The important part of the code I have copied below.

For to help, I've numbered the lines.

1  void Button1_Click(Object sender, EventArgs e)
2  {
3      string str = TextBox1.Text;
4      int num = Convert.ToInt32(str);
5      string strConnect = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source="+Server.MapPath(".\\db\\tstdb.mdb");
6      string strupdate = "UPDATE tsttbl SET value = value + str";
7
8      // ... Remainder of method here ...
9  }


In line 6 you define the SQL statement you use to update the database. What this says is: Update all records (because there is no where clause) in tsttble and set the value field to be its current value plus the value of the str field. However there is no str field in the database.

I am guessing, because you've not said, that the str value that you really want is the one defined on line 3. If this is correct change line 6 to:
string strupdate = string.Concat("UPDATE tsttbl SET value = value + ",num.ToString());


I've used num instead of str because num is guaranteed to be a valid integer.

I hope all this helps.

Regards,
Colin.

--Colin Mackay--

"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)

Enumerators in .NET: See how to customise foreach loops with C#


GeneralRe: :: problem in UPDATE statement :: Pin
Majid al-Sarra13-Dec-03 0:46
Majid al-Sarra13-Dec-03 0:46 
QuestionAccess database - change password? Pin
Rickard Andersson2010-Dec-03 8:40
Rickard Andersson2010-Dec-03 8:40 
GeneralInserting files into database table Pin
tmagoo10-Dec-03 5:45
tmagoo10-Dec-03 5:45 
GeneralRe: Inserting files into database table Pin
10-Dec-03 8:05
suss10-Dec-03 8:05 
GeneralADO.NET Pin
sreemurali9-Dec-03 10:59
sreemurali9-Dec-03 10:59 
GeneralADO.NET Pin
sreemurali9-Dec-03 10:59
sreemurali9-Dec-03 10:59 
GeneralDatasets Pin
Mohan BV8-Dec-03 22:11
Mohan BV8-Dec-03 22:11 
GeneralRe: Datasets Pin
gokselm16-Dec-03 23:32
gokselm16-Dec-03 23:32 
Questionhow can i use ado to open mdb file In Visual basic6 Pin
meirav8-Dec-03 8:32
meirav8-Dec-03 8:32 
GeneralRe: how can i use ado to open mdb file In Visual basic6 Pin
Mike Dimmick9-Dec-03 3:13
Mike Dimmick9-Dec-03 3:13 
Generalcombining agregate function with select statements Pin
Petu7-Dec-03 9:49
Petu7-Dec-03 9:49 
GeneralRe: combining agregate function with select statements Pin
Colin Angus Mackay7-Dec-03 14:20
Colin Angus Mackay7-Dec-03 14:20 
GeneralConcurrency issues in databases Pin
Shah Shehpori4-Dec-03 18:56
sussShah Shehpori4-Dec-03 18:56 
Questionis it possible to create a database in the client side for a windows based using visual studio .NET? Pin
Anonymous4-Dec-03 13:20
Anonymous4-Dec-03 13:20 
AnswerRe: is it possible to create a database in the client side for a windows based using visual studio .NET? Pin
Colin Angus Mackay7-Dec-03 14:03
Colin Angus Mackay7-Dec-03 14:03 
QuestionTrouble with an SQL statement...maybe syntax related? Pin
frank214-Dec-03 8:24
frank214-Dec-03 8:24 
AnswerRe: Trouble with an SQL statement...maybe syntax related? Pin
Chris Meech9-Dec-03 7:16
Chris Meech9-Dec-03 7:16 

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.