Open table with ?

Posted on 2006-05-01
Last Modified: 2006-11-18
can someone provide me with a small code example of how to open a table on the sql server, using vb 2005 using
Question by:szx248
    LVL 2

    Accepted Solution

    Dim connect As New SqlConnection("Initial Catalog = Northwind;
           Data Source=(local); User ID=sa; password = ;Connect _


    Console.WriteLine("Database: " & connect.Database)
    Console.WriteLine("Database: " & connect.ServerVersion)
    Console.WriteLine("Database: " & connect.DataSource)

    Dim command As New SqlCommand("SELECT * from tablename", connect)
    Dim reader As SqlDataReader = _
                  command.ExecuteReader( _

    While reader.Read()
    End While


    Expert Comment

    What I'm trying to do is add a new record to a table.
    So that leads me to two more questions -
    1. Wouldn't doing this Select * be a extra overhead?
    2. Now that I have a reader, how can I add a record to this table?  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    794 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

    15 Experts available now in Live!

    Get 1:1 Help Now