Results 1 to 3 of 3

Thread: My first thread

  1. #1

    Thread Starter
    Registered User
    Join Date
    Oct 2002
    Posts
    41

    Smile 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

  2. #2
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857

    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!

  3. #3
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396
    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
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width