TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Atul Rokade
NA
141
43.7k
No overload for method 'TryParse' takes '1' arguments
Mar 21 2016 12:29 PM
Actually im trying to insert as well as update data into datagridview at run time for that i have written one code but while executing it give me Data type No overload for method 'TryParse' takes '1' arguments
my accdb table structure is like below
(guys need urgent help please)
Field Datatype
Account-- Memo
AccountNumber--Number
Date--Date/Time
Description--Memo
Post_Ref--Memo
Debit--Number
Credit--Number
Balance--Number
code is :
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
string connectionString = null;
connectionString = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
con.ConnectionString = connectionString;
string cmd1 = "insert into Ledger([Account],[AccountNumber],[Date],[Description],[Post_Ref],[Debit],[Credit],[Balance])values(?,?,?,?,?,?,?,?)";
OleDbCommand cmd = new OleDbCommand(cmd1, con);
con.Open();
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Account",dataGridView1.Rows[e.RowIndex].Cells["Account"].Value.ToString());
cmd.Parameters.AddWithValue("@AccountNumber",int.TryParse(dataGridView1.Rows[e.RowIndex].Cells["AccountNumber"].Value));
cmd.Parameters.AddWithValue("@Date", DateTime.TryParse(dataGridView1.Rows[e.RowIndex].Cells["Date"].Value));
cmd.Parameters.AddWithValue("@Description", dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString());
cmd.Parameters.AddWithValue("@Post_Ref", dataGridView1.Rows[e.RowIndex].Cells["Post_Ref"].Value.ToString());
cmd.Parameters.AddWithValue("@Debit", Int32.TryParse(dataGridView1.Rows[e.RowIndex].Cells["Debit"].Value));
cmd.Parameters.AddWithValue("@Credit", Int32.TryParse(dataGridView1.Rows[e.RowIndex].Cells["Credit"].Value));
cmd.Parameters.AddWithValue("@Balance", Int32.TryParse(dataGridView1.Rows[e.RowIndex].Cells["Balance"].Value));
int n = cmd.ExecuteNonQuery();
con.Close();
Load_data();
}
Reply
Answers (
11
)
Adding checkbox column in datagridview at specific position.
Asp.net webapp become mobile enabled.