ilovevbsomuchimmad
Programmer
Hi, I know im going to sound stupid but I need help with linking Vb.Net to access. I would prefer the most easy approach as I have not that much knowledge.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub OpenTables()
Dim sCon as String="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"
Dim Con As ADODB.Connection = New ADODB.Connection
Dim rsTBL As ADODB.Recordset = New ADODB.Recordset
Con.ConnectionString = sCon
Con.Open(sCon )
rsTBL = Con.OpenSchema(ADODB.SchemaEnum.adSchemaTables)
While Not rsTBL.EOF
'MsgBox(rsTBL.Fields(3).Value)
If rsTBL.Fields(3).Value = "TABLE" Then
Dim NodeX As TreeNode = New TreeNode
NodeX.ImageIndex = 6
NodeX.SelectedImageIndex = 6
NodeX.Text = rsTBL(2).Value
TV1.Nodes.Add(TV1.SelectedNode.Nodes.Add(NodeX))
End If
rsTBL.MoveNext()
End While
rsTBL.Close()
rsTBL = Nothing
Con.Close()
Con = Nothing
End Sub
Private Sub AddViews()
Dim Con As ADODB.Connection = New ADODB.Connection
Dim rsVW As ADODB.Recordset = New ADODB.Recordset
'On Error Resume Next
Con.ConnectionString = sCon
Con.Open(Con.ConnectionString)
rsVW = Con.OpenSchema(ADODB.SchemaEnum.adSchemaTables)
While Not rsVW.EOF
If rsVW.Fields(3).Value = "System VIEW" Then
Dim NodeX As TreeNode = New TreeNode
NodeX.ImageIndex = 12
NodeX.SelectedImageIndex = 12
NodeX.Text = rsVW(2).Value
End If
rsVW.MoveNext()
End While
rsVW.Close()
rsVW = Nothing
Con.Close()
Con = Nothing End Sub
If txtSQL.Text = "" Then Exit Sub
Dim Con As ADODB.Connection = New ADODB.Connection
Dim RS As ADODB.Recordset = New ADODB.Recordset
Dim sCon As String = Label1.Text
Dim DS As DataSet = New DataSet("DSName")
Dim DR As DataRow
Dim TBL As DataTable = New DataTable("Table")
Dim DC As DataColumn
Dim i As Integer, j As Int16
SSPI = GetSSPI
Con.ConnectionString = sCon
Con.Open(sCon)
Try
RS.Open(txtSQL.Text, Con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, ADODB.CommandTypeEnum.adCmdText)
Catch ex As Exception
txtErr.Text = ex.Message
Exit Sub
End Try
For i = 0 To RS.Fields.Count - 1
DC = New DataColumn(RS.Fields(i).Name)
TBL.Columns.Add(DC)
Next
Do While Not RS.EOF
DR = TBL.NewRow
For i = 0 To RS.Fields.Count - 1
DR(i) = RS(i).Value
Next
TBL.Rows.Add(DR)
RS.MoveNext()
Loop
DS.Tables.Add(TBL)
DG1.SetDataBinding(DS, "Table")
End Sub