15,922,407 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by d!l33p nair (Top 9 by date)
d!l33p nair
14-Mar-14 10:20am
View
Deleted
i can give u some screen shots of my test project... please see it one by one...
www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg
www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg
www.dotitsolutions.in/errors/3_my_code.jpg
www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg
www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg
www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg
i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 10:20am
View
Deleted
i can give u some screen shots of my test project... please see it one by one...
www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg
www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg
www.dotitsolutions.in/errors/3_my_code.jpg
www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg
www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg
i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 10:19am
View
Deleted
i can give u some screen shots of my test project... please see it one by one...
www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg
www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg
www.dotitsolutions.in/errors/3_my_code.jpg
www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg
i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 10:17am
View
Deleted
i can give u some screen shots of my test project... please see it one by one... www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg www.dotitsolutions.in/errors/3_my_code.jpg www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 10:17am
View
Deleted
i can give u some screen shots of my test project... please see it one by one... www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg www.dotitsolutions.in/errors/3_my_code.jpg www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 9:56am
View
Deleted
i can give u some screen shots of my test project...
please see it one by one...
www.dotitsolutions.in/errors/1_db_malabar.temp_sales_info.jpg
www.dotitsolutions.in/errors/2_my_sales_entry_form.jpg
www.dotitsolutions.in/errors/3_my_code.jpg
www.dotitsolutions.in/errors/4_at_run_time_multiple_rows_saved.jpg
www.dotitsolutions.in/errors/5_after_click_on_ok_this_error.jpg
www.dotitsolutions.in/errors/6_error_without_try_catch_block.jpg
i think all thinks are going right but what was that error? "object reference not set to an instance of an object" please help
d!l33p nair
14-Mar-14 9:11am
View
tq for your reply.
the error line is...
cmd.Parameters.AddWithValue( "@item_name", dgNewSale.Rows[row].Cells["dgItemName"].Value.ToString());
till the end. i mean the all lines related to datagridview.
d!l33p nair
14-Mar-14 8:57am
View
hey buddy, i tried new codes, in new ways. it can insert multiple rows but, i got an error, which is "object reference not set to an instance of an object" here is the code... why this error happened?
private void cmdSave_Click(object sender, EventArgs e)
{
string config = "server=localhost; userid = root; database = db_malabar";
MySqlConnection con = new MySqlConnection(config);
string query = "INSERT INTO db_malabar.temp_sales_info(invoice_number, customer_name, address, customer_phone_number, date_of_purchase, time_of_purchase, item_code, item_name, unit, quantity, retail_unit_price, total_amount, discount, grand_total) VALUES (@invoice_number, @customer_name, @address, @customer_phone_number, @date_of_purchase, @time_of_purchase, @item_code, @item_name, @unit, @quantity, @retail_unit_price, @total_amount, @discount, @grand_total)";
MySqlCommand cmd = new MySqlCommand(query, con);
con.Open();
try
{
for (int row = 0; row < dgNewSale.Rows.Count; row++)
{
cmd.Parameters.AddWithValue(
"@invoice_number", txtInvoiceNumber.Text);
cmd.Parameters.AddWithValue(
"@customer_name", txtCustomerName.Text);
cmd.Parameters.AddWithValue(
"@address", txtAddress.Text);
cmd.Parameters.AddWithValue(
"@customer_phone_number", txtPhoneNumber.Text);
cmd.Parameters.AddWithValue(
"@date_of_purchase", lblDateDisplay.Text);
cmd.Parameters.AddWithValue(
"@time_of_purchase", lblTimeDisplay.Text);
cmd.Parameters.AddWithValue(
"@item_name", dgNewSale.Rows[row].Cells["dgItemName"].Value.ToString());
cmd.Parameters.AddWithValue(
"@item_code", dgNewSale.Rows[row].Cells["dgItemCode"].Value.ToString());
cmd.Parameters.AddWithValue(
"@unit", dgNewSale.Rows[row].Cells["dgUnit"].Value.ToString());
cmd.Parameters.AddWithValue(
"@quantity", dgNewSale.Rows[row].Cells["dgQuantity"].Value.ToString());
cmd.Parameters.AddWithValue(
"@retail_unit_price", dgNewSale.Rows[row].Cells["dgUnitPrice"].Value.ToString());
cmd.Parameters.AddWithValue(
"@total_amount", dgNewSale.Rows[row].Cells["dgAmount"].Value.ToString());
cmd.Parameters.AddWithValue(
"@discount", dgNewSale.Rows[row].Cells["dgDiscount"].Value.ToString());
cmd.Parameters.AddWithValue(
"@grand_total", dgNewSale.Rows[row].Cells["dgGrandTotal"].Value.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
MessageBox.Show("Success");
}
con.Close();
}
catch (Exception er)
{
MessageBox.Show(er.Message);
}
}
d!l33p nair
14-Mar-14 8:44am
View
tq for your reply. i am not perfect in c#. but i will try. tq. :)
Show More