VB 2008

Posted on 2011-10-20
Last Modified: 2012-05-12
What is, and what are the forms of connection objects in Visual Bisic 2008?
Question by:ervolino
    LVL 7

    Accepted Solution

    If you are connecting to a SQL Server database you can create a connection object like this:

    Dim con As SqlConnection = New SqlConnection("Data Source={db server};Initial Catalog={Table};User Id={ID};Password={password}")

    replacing the {} with your database specifics.

    You can then create a command that contains the SQL you want to execute against the database:

    Dim cmd As SqlCommand = New SqlCommand({Query}, con)

    The query is just a string type, e.g. "SELECT * FROM dbo.Users WHERE UserID = '123'"

    Then execute the query, e.g. if you are returning a dataset:

     Dim dt As DataTable = New DataTable()
                Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)

    Or if you are not returning anything with your query use:


    MSDN will be able to go into allot more detail.



    Author Comment

    Thank you.
    I could use another database?
    LVL 13

    Assisted Solution

    by:Jesus Rodriguez
    Yes, check this link

    You must specify the connection string. I also I'm working with it connected with noble from IBM
    LVL 13

    Assisted Solution

    by:Jesus Rodriguez
    LVL 69

    Expert Comment

    by:Éric Moreau
    LVL 7

    Expert Comment

    You could use OLEDB, ODBC types of connection objects instead of SQL but the same logic applies.

    Author Closing Comment


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now