Need help working with , cpp , csharp San Juan, Puerto Rico
  • 12 years ago
    I am new to VB, I made a table using ado, but I need to pass the data from a datagrid to the table. The code for the table is like this: Dim TableName As String = "" 'Giving name to the table TableName = "Pareo" Dim dsStr As String Dim dsCn As String Dim cnADO As ADODB.Connection Dim mdb As ADOX.Catalog Dim dt As ADOX.Table Try mdb = New ADOX.Catalog() cnADO = New ADODB.Connection() dsStr = My.Settings.DataSource dsCn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dsStr + ";" cnADO.ConnectionString = dsCn cnADO.Open() mdb.ActiveConnection = cnADO 'Creating the table dt = New ADOX.Table() dt.Name = nombreTabla dt.Columns.Append("Num", ADOX.DataTypeEnum.adWChar, 5) dt.Columns.Append("NI", ADOX.DataTypeEnum.adWChar, 10) dt.Columns.Append("Name", ADOX.DataTypeEnum.adWChar, 20) dt.Columns.Append("Rnd" & i, ADOX.DataTypeEnum.adWChar, 5) dt.Columns.Append("EloBirdInicial", ADOX.DataTypeEnum.adWChar, 10) dt.Columns.Append("EloBirdFinal", ADOX.DataTypeEnum.adWChar, 10) dt.Keys.Append("PK_NewTable", ADOX.KeyTypeEnum.adKeyPrimary, _ "NI") mdb.Tables.Append(dt) Catch ex As Exception MessageBox.Show(ex.Message, "The table was not created") End End Try MessageBox.Show("The table was created", "Now", MessageBoxButtons.OK) End I need to pass data form a datagrid to this table, I hope someone can help me

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup