Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: running automatically asp.net website Pin
Heath Stewart7-Jun-04 11:27
protectorHeath Stewart7-Jun-04 11:27 
GeneralException variable never used Pin
Dominik Reichl7-Jun-04 10:03
Dominik Reichl7-Jun-04 10:03 
GeneralRe: Exception variable never used Pin
Dave Kreskowiak7-Jun-04 10:15
mveDave Kreskowiak7-Jun-04 10:15 
GeneralRe: Exception variable never used Pin
leppie7-Jun-04 10:42
leppie7-Jun-04 10:42 
GeneralRe: Exception variable never used Pin
Heath Stewart7-Jun-04 11:25
protectorHeath Stewart7-Jun-04 11:25 
GeneralRe: Exception variable never used Pin
Dave Kreskowiak7-Jun-04 11:57
mveDave Kreskowiak7-Jun-04 11:57 
GeneralRe: Exception variable never used Pin
leppie7-Jun-04 12:54
leppie7-Jun-04 12:54 
GeneralUsing variable in Values for SQL insert Pin
kv_ajay7-Jun-04 8:40
kv_ajay7-Jun-04 8:40 
Hi All,

Just a simple question. I am trying to add the data in a access database (file residing on local machine.) I saw the format and worked according to it. Here is the code.

Console.WriteLine(CBoxCatagory.SelectedItem.ToString());
String sSql = "INSERT INTO MainCatagory" + "(MainCatagory)" + "VALUES("+CBoxCatagory.SelectedText+")" ;
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +@"Data source= C:\" + @"My Documents\db1.mdb";
conn.Open();
OleDbCommand objCommandMain = new OleDbCommand(sSql,conn);
objCommandMain.ExecuteNonQuery();

When I use the fixed or hard data in Values then statement executes fine. But when I am trying to execute with a variable of type ComboBox then it is giving me error. I also tried to use a simple string variable and see the result and it was same. Seems like there is problem in the syntax for adding values using variables.

Here is the error.
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

Can you suggest me something on this one.

Thanks,
Smile | :)
GeneralRe: Using variable in Values for SQL insert Pin
Alvaro Mendez7-Jun-04 8:55
Alvaro Mendez7-Jun-04 8:55 
GeneralRe: Using variable in Values for SQL insert Pin
Anonymous7-Jun-04 9:47
Anonymous7-Jun-04 9:47 
GeneralRe: Using variable in Values for SQL insert Pin
Dave Kreskowiak7-Jun-04 9:55
mveDave Kreskowiak7-Jun-04 9:55 
GeneralRe: Using variable in Values for SQL insert Pin
Anonymous7-Jun-04 10:06
Anonymous7-Jun-04 10:06 
GeneralRe: Using variable in Values for SQL insert Pin
Dave Kreskowiak7-Jun-04 10:13
mveDave Kreskowiak7-Jun-04 10:13 
GeneralRe: Using variable in Values for SQL insert Pin
Anonymous7-Jun-04 10:36
Anonymous7-Jun-04 10:36 
GeneralRe: Using variable in Values for SQL insert Pin
Heath Stewart7-Jun-04 11:23
protectorHeath Stewart7-Jun-04 11:23 
GeneralReadFileEx OVERLAPPED LocalAlloc wows Pin
gdwinslow7-Jun-04 8:03
gdwinslow7-Jun-04 8:03 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Heath Stewart7-Jun-04 11:19
protectorHeath Stewart7-Jun-04 11:19 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
gdwinslow7-Jun-04 16:23
gdwinslow7-Jun-04 16:23 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Heath Stewart8-Jun-04 2:55
protectorHeath Stewart8-Jun-04 2:55 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Guy Winslow8-Jun-04 11:17
Guy Winslow8-Jun-04 11:17 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Heath Stewart8-Jun-04 11:26
protectorHeath Stewart8-Jun-04 11:26 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Guy Winslow8-Jun-04 12:42
Guy Winslow8-Jun-04 12:42 
GeneralRe: ReadFileEx OVERLAPPED LocalAlloc wows Pin
Heath Stewart8-Jun-04 17:15
protectorHeath Stewart8-Jun-04 17:15 
Generalsql server ce 2.0, image data type Pin
khchan7-Jun-04 6:45
khchan7-Jun-04 6:45 
GeneralRe: sql server ce 2.0, image data type Pin
Heath Stewart7-Jun-04 6:51
protectorHeath Stewart7-Jun-04 6:51 

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.