Importing SQL Table to the Data Grid
Hi
I need help with importing SQL database table into the Data Grid using VB.NET . I have a SQL table which I like to bind to the Data Grid . I want to see the data from the SQL table to imported to the Data Grid . How do I do that using VB.NET
Thanks
# 2 Re: Importing SQL Table to the Data Grid
Hi
Thanks for your help . I am able to import data from the SQL Server table to the .NET data Grid and able to update that . I have another request . How do I generate the data grid column dynamically . I like to have user add column in the data grid and able to save that information back to the data base . Also SQL Server table ( where the data grid information will be saved ) will able to create the column dynamically according to the data grid column . So My question is how do I create coulmn in data grid dynamically and also add column in the SQL table dynamically
Thanks
# 3 Re: Importing SQL Table to the Data Grid
You may use the ALTER TABLE SQL command to dynamically add a column to a table. See http://www.vbdotnetheaven.com/Code/Jul2003/2130.asp for more information.
Once the column is added to the table, simply create a new DataTable that includes the new column and bind it to the DataGrid, as you are already doing.
# 5 Re: Importing SQL Table to the Data Grid
Hi
Thanks for all your help . I have got the dynamic database field creation working . But I can not save the data that came to the data grid from CSV file to a SQL table . I can import CSV file to a .NET data grid and modify that . But I can not save it to the data base . I like to have client export the data from the CSV file to the data grid and make changes in the data grid and save that back to the SQL server table . How do I do that . Also is that possible to import .CSV data to data grid using SQL Adapter . I can do the import using oledb connection but not SQL connection .
Thanks