this is a my first thread with you and i have some questions.
Q1:
how to split the film
Q2:
how to link vb with SQL Database
and thank's :)
Printable View
this is a my first thread with you and i have some questions.
Q1:
how to split the film
Q2:
how to link vb with SQL Database
and thank's :)
A1: What?Quote:
Originally posted by Visual Basic
this is a my first thread with you and i have some questions.
Q1:
how to split the film
Q2:
how to link vb with SQL Database
and thank's :)
A2: There are several ways. What do you want to link? A textbox, a datagrid? If so, you can add a datacontrol to a form, set it's connection string to the database and set the data sorce of the control (textbox, datagrid) to the datacontrol.
You can also create recordsets with DAO or ADO very easily.
There are a ton of examples in the msdn library
SPLIT THE FILM??????
This how you connect to SQL using VB:
[Highlight=VB]
Dim adoConn As ADODB.Connection
Dim adoRst As ADODB.Recordset
Private Sub Form_Load()
'===========================
Dim strConString As String
Dim strSQL As String
On Error GoTo ErrorHandler
strConString = "Provider=SQLOLEDB.1;Password=;Persist Security Info=True;" _
& "User ID=sa=;Initial Catalog=MyDATABASENAME;Data Source=MYSQLNAME"
Set adoConn = New ADODB.Connection
adoConn.Open strConString
strSQL = "Select * From Contacts Where ID between 30 and 35;"
Set adoRst = New ADODB.Recordset
With adoRst
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL, adoConn, , , adCmdText
End With
Exit Sub
ErrorHandler:
'--------------
Debug.Print Me.Name & " {Form_Load} :"; Err.Number & " - " & Err.Description
Err.Clear
Resume Next
End Sub