Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
GeneralRe: Connect to pc using DSL ? Pin
Muammar©5-May-07 1:47
Muammar©5-May-07 1:47 
GeneralRe: Connect to pc using DSL ? Pin
shdelpiero5-May-07 5:21
shdelpiero5-May-07 5:21 
GeneralRe: Connect to pc using DSL ? Pin
Dave Kreskowiak5-May-07 18:07
mveDave Kreskowiak5-May-07 18:07 
QuestionUploading a file from C# Windows Application to ASP.NEtTWeb form Pin
Raza Hussain4-May-07 20:19
Raza Hussain4-May-07 20:19 
QuestionAbout Webbrowser's MesssageBox Pin
amon04244-May-07 20:05
amon04244-May-07 20:05 
Questioninserting unicode character from c# program to sql server 2005 Pin
rehab14-May-07 19:54
rehab14-May-07 19:54 
AnswerRe: inserting unicode character from c# program to sql server 2005 Pin
lost in transition 4-May-07 20:22
lost in transition 4-May-07 20:22 
Questioninserting unicode character from c# to sql server 2005 Pin
rehab14-May-07 19:52
rehab14-May-07 19:52 
AnswerRe: inserting unicode character from c# to sql server 2005 Pin
Hesham Amin4-May-07 22:23
Hesham Amin4-May-07 22:23 
QuestionObject reference not set to an instance of an object. Pin
balanjingot4-May-07 19:19
balanjingot4-May-07 19:19 
AnswerRe: Object reference not set to an instance of an object. Pin
lost in transition 4-May-07 19:50
lost in transition 4-May-07 19:50 
GeneralRe: Object reference not set to an instance of an object. Pin
balanjingot4-May-07 20:00
balanjingot4-May-07 20:00 
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 
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 
hi everybody,

thanks for your reply and suggestions, finally i got the solution to my problem...


my revised code:

private void button13_Click(object sender, EventArgs e)
{
try
{


for (int i = 0; i < dataGridView4.Rows.Count -1; i++)
{
DataGridViewRow row = dataGridView4.Rows[i];

long itemcode = 0;
string description = "";
int quantity = 0;
string unit = "";

itemcode = Convert.ToInt64(row.Cells[0].Value);

if (description != null)
{
description = row.Cells[1].Value.ToString() + "";
}

quantity = Convert.ToInt32(row.Cells[2].Value);
unit = row.Cells[3].Value.ToString();

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


MySqlCommand command = new MySqlCommand(query, connection);
MessageBox.Show(command.ExecuteNonQuery().ToString());

}
}

thanks guys


regardsSmile | :)

jing

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.