|
-
Oct 30th, 2002, 02:33 PM
#1
Thread Starter
Registered User
My first thread
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
-
Oct 30th, 2002, 02:44 PM
#2
Fanatic Member
Re: My first thread
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
A1: What?
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
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Oct 30th, 2002, 02:48 PM
#3
Frenzied Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|