1

I change the header name of a datagridview using the following code

Me.DataGridView1.Columns(0).HeaderText = "xxxx"

How can I apply this change to the Access database? Like when I rename first column in datagrid view I want the first column in database to be the same.

1 Answer 1

1

There isn’t a .Net API that allows changes to the gridview’s headers to propagate back to the database's columns. The gridview object supports binding to multiple sources (among those MS Access, Sql Server, Oracle, Object collections etc.) and does not contain the DDL logic required to update the SQL based data sources. Therefore, you will need to perform two separate actions: one on the access database and one within the asp.net code.

Sign up to request clarification or add additional context in comments.

4 Comments

it is an access database i don't use sql, the database is on local drive, so no way to do it?
You would have to write the data definition language SQL in order to programtically change the schema of the table; or look for an Access specific API that allows the change.
how can i do the SQL command option in vb.net can you please show me a sample code
Here is link that should help: link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.