I am trying to connect to tables I created on SQL Server 7 using
VB.net, but I can't I get the error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Whenever I connect to the same database but to the northwind or pubs database that is fine, it is just when I create a database then try to connect to the tables within it. Here is my code:
Imports System.Data
Imports System.Data.OleDb
Imports System.DBNull
Public Class Form1
Inherits System.Windows.Forms.Form
Dim objconnection As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB;" & _
"Datasource=Intranet;Initial Catalog=heads;" & _
"integrated Security=SSPI;")
Dim objdataadapter As OleDbDataAdapter
Dim objdataset As DataSet
Dim objdataview As DataView
Dim objcurrencymanager As CurrencyManager
objdataview = Nothing
objdataset = New DataSet
objconnection.Open()
objdataadapter = New OleDbDataAdapter("SELECT quotekey FROM quotes", objconnection)
objdataadapter.Fill(objdataset, "quotes")
objdataview = New DataView(objdataset.Tables("quotes"))
objcurrencymanager = CType(Me.BindingContext(objdataview), CurrencyManager)
objconnection.Close()
objdataset = Nothing
txtID.DataBindings.Add("Text", objdataview, "quotekey")
Any help on this matter would be greatly appreciated.
Thanks