Click here to Skip to main content
15,877,547 members
Home / Discussions / C#
   

C#

 
GeneralRe: Object reference not set to an instance of an object. Pin
lost in transition 4-May-07 20:20
lost in transition 4-May-07 20:20 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot4-May-07 20:58
balanjingot4-May-07 20:58 
AnswerRe: Object reference not set to an instance of an object. Pin
PIEBALDconsult4-May-07 19:53
mvePIEBALDconsult4-May-07 19:53 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot4-May-07 20:04
balanjingot4-May-07 20:04 
GeneralRe: Object reference not set to an instance of an object. Pin
lmoelleb4-May-07 21:16
lmoelleb4-May-07 21:16 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot4-May-07 21:49
balanjingot4-May-07 21:49 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot4-May-07 21:46
balanjingot4-May-07 21:46 
GeneralRe: Object reference not set to an instance of an object. Pin
PIEBALDconsult5-May-07 4:14
mvePIEBALDconsult5-May-07 4:14 
In your

String query = "INSERT INTO test(itemcode,description,quantity,unit) VALUES (itemcode,description,quantity,unit)";

You'll want to use parameters for itemcode,description,quantity,unit
I'm not as familiar with MySql, but in Sql Server I'd prefix each with an @

@itemcode,@description,@quantity,@unit

Then instantiate a MySqlParameter for each and add them to the command's parameter collection.

Roughly: command.Parameters.Add ( new MySqlParameter ( "@itemcode" , itemcode ) ;

But if you're going to be inserting a bunch of data in a loop, you'll want something like: command.Parameters.Add ( new MySqlParameter ( "@itemcode" , typeof(itemcode) ) ;

then in the loop: command.Parameters [ "@itemcode" ].Value = itemcode ; (will that work?)
GeneralRe: Object reference not set to an instance of an object. Pin
PIEBALDconsult5-May-07 4:45
mvePIEBALDconsult5-May-07 4:45 
GeneralRe: Object reference not set to an instance of an object. Pin
PIEBALDconsult5-May-07 5:01
mvePIEBALDconsult5-May-07 5:01 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot6-May-07 14:23
balanjingot6-May-07 14:23 
AnswerRe: Object reference not set to an instance of an object. Pin
Rob Graham5-May-07 12:08
Rob Graham5-May-07 12:08 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot6-May-07 14:28
balanjingot6-May-07 14:28 
AnswerRe: Object reference not set to an instance of an object. Pin
AFSEKI7-May-07 3:07
AFSEKI7-May-07 3:07 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot7-May-07 14:32
balanjingot7-May-07 14:32 
QuestionHow to expand/decompress RAR archives with C#? Pin
Uwe Keim4-May-07 10:56
sitebuilderUwe Keim4-May-07 10:56 
AnswerRe: How to expand/decompress RAR archives with C#? Pin
Tarakeshwar Reddy4-May-07 11:04
professionalTarakeshwar Reddy4-May-07 11:04 
GeneralRe: How to expand/decompress RAR archives with C#? Pin
Uwe Keim4-May-07 11:09
sitebuilderUwe Keim4-May-07 11:09 
AnswerRe: How to expand/decompress RAR archives with C#? Pin
Uwe Keim4-May-07 11:04
sitebuilderUwe Keim4-May-07 11:04 
Questionloading form 1 after the other Pin
samreengr84-May-07 10:50
samreengr84-May-07 10:50 
AnswerRe: loading form 1 after the other Pin
MoustafaS4-May-07 12:36
MoustafaS4-May-07 12:36 
AnswerRe: loading form 1 after the other Pin
Arun.Immanuel4-May-07 16:12
Arun.Immanuel4-May-07 16:12 
AnswerRe: loading form 1 after the other Pin
AFSEKI7-May-07 3:13
AFSEKI7-May-07 3:13 
Questionhow to align the label controls in group box according to their text size Pin
engsrini4-May-07 10:35
engsrini4-May-07 10:35 
QuestionComboBox ... Pin
mostafa_h4-May-07 8:44
mostafa_h4-May-07 8:44 

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.