Make a table appear in the data sources window using ado.net

  • Thread starter Thread starter JohnDBCTX
  • Start date Start date
J

JohnDBCTX

Guest
Hello,

I want to create a table in the data sources window using ado.net.

If it is possible, then can anyone provide me the steps?


ConnX = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\NamesDatabase.mdb")
da = New OleDbDataAdapter("CREATE TABLE EmailAddresses(EmailID int NOT NULL,
Name Email(50) NULL,
ID int FOREIGN KEY REFERENCES tblNames(ID)", ConnX) 'Create the DataAdapter.

Dim ds As DataSet = New DataSet("EmailAddresses") 'Fill the DataSet with data.
Dim dt As DataTable = New DataTable("EmailAddresses")

Dim DataGridView1 As New DataGridView()
Dim BindingSource1 As New BindingSource()


Dim column1 As New DataGridViewTextBoxColumn()
Dim column2 As New DataGridViewTextBoxColumn()
Dim column3 As New DataGridViewTextBoxColumn()



column1.DataPropertyName = "EmailID"
column1.Name = "EmailID"
DataGridView1.Columns.Add(column1)
DataGridView1.Item(0, 0).Value = "1"


column2.DataPropertyName = "Name"
column2.Name = "Name"
DataGridView1.Columns.Add(column2)
DataGridView1.Item(1, 0).Value = ""

column3.DataPropertyName = "ID"
column3.Name = "ID"
DataGridView1.Columns.Add(column3)
DataGridView1.Item(2, 0).Value = "1"




With DataGridView1
.Height = 1000
.Top = 500
.Left = 500
.Width = 1000
End With


column1.Visible = True
column2.Visible = True
column3.Visible = True

' Initialize the form.
Me.Controls.Add(DataGridView1)
Me.AutoSize = True

End Sub

Here is the screenshot:

1538565.png

What I want to perform is to create a table in the data sources window. Here is the current table:

1538566.png


All users are welcome to assist me in this task.


Regards,


JohnDBCTX


jp

Continue reading...
 
Back
Top