0

Hey

I have attached my program to the thread.

I have an access database called "Database". I have 3 textboxes. "name" "age" and "language" as an example.

When the accept button is clicked, i want that information to update to the database.

I can only do it with a datagridview, but now i want to do it without, as there is no need for it.

Thank you
Rua

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by Mr.BunyRabit
1

Yes you can do it without gridview.. you just need to write a Updatae query to update the data in database..

your code looks like below..

OleDbCommand objCmd = new OleDbCommand();
objCmd.Connection = objCon;
objCmd.CommandText = "Update yourtablename Set col1=@col1, col2=@col2 Where idcolum=@idcol";
objCmd.Parameters.AddWithValue("@col1", txtnam.Text);
objCmd.Parameters.AddWithValue("@col2", txtnam.Text);
objCmd.Parameters.AddWithValue("@idcol", txtID.Text);
objCon.Open();
objCmd.ExecuteNonQuery();
objCon.Close();

that's all.. try by above code and let me know...

Hey

I have attached my program to the thread.

I have an access database called "Database". I have 3 textboxes. "name" "age" and "language" as an example.

When the accept button is clicked, i want that information to update to the database.

I can only do it with a datagridview, but now i want to do it without, as there is no need for it.

Thank you
Rua

0

Yes you can do it without gridview.. you just need to write a Updatae query to update the data in database..

your code looks like below..

OleDbCommand objCmd = new OleDbCommand();
objCmd.Connection = objCon;
objCmd.CommandText = "Update yourtablename Set col1=@col1, col2=@col2 Where idcolum=@idcol";
objCmd.Parameters.AddWithValue("@col1", txtnam.Text);
objCmd.Parameters.AddWithValue("@col2", txtnam.Text);
objCmd.Parameters.AddWithValue("@idcol", txtID.Text);
objCon.Open();
objCmd.ExecuteNonQuery();
objCon.Close();

That worked perfectly, =),
Thank you =)

that's all.. try by above code and let me know...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.