SQL Server 2008 Express
Visual Basic 2010 Express
.NET 4 Framework
I am trying connect to a SQL Server database i have created using Visual Basic. Both reside on my local machine (PAUL-PC).
Here is what i have done so far but i am missing something (or more worryingly i have got it completely wrong)...
Public Class frmMainMDI Dim con As New OleDb.OleDbConnection Dim rs As New OleDb.OleDbDataAdapter Dim cmd As New OleDb.OleDbCommand Dim strconnect As String Private Sub frmMainMDI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load strconnect = "Provider=SQLOLEDB;Data Source=PAUL-PC\\SQLExpress;Initial Catalog=ScubaDiveBookingSystem; Integrated Security=SSPI;" con.Open(strconnect) 'definitely not sure about this bit End Sub End Class
So i have an MDI form and i want to make a connection to SQL Server when that form loads.
I do not want to use a DSN if possible so am trying to use Oledb. Not sure also of the DataAdaptor declaration as in previous versions i used many years ago it was recordset.
I have been looking at these sites to try and help but am not sure...
I would like to use a trusted connection to connect.
Any pointers would be very helpful
This post has been edited by KnooKie: 07 May 2010 - 10:08 PM