Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

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
[271 byte] By [software_develo] at [2007-11-11 7:18:21]
# 1 Re: Importing SQL Table to the Data Grid
http://www.vb-helper.com/howto_net_datagrid.html
Phil Weber at 2007-11-11 21:49:14 >
# 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
software_develo at 2007-11-11 21:50:20 >
# 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.
Phil Weber at 2007-11-11 21:51:24 >
# 4 Re: Importing SQL Table to the Data Grid
Hi

Thanks for your help always . I will try and let you know how that go

Thanks
software_develo at 2007-11-11 21:52:16 >
# 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
software_develo at 2007-11-11 21:53:26 >