VB 2008

gentlemen,
What is, and what are the forms of connection objects in Visual Bisic 2008?
grateful
ervolinoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alex_WCommented:
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)
            da.Fill(dt)

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

cmd.ExecuteNonQuery.

MSDN will be able to go into allot more detail.

Rgds,

Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ervolinoAuthor Commented:
Thank you.
I could use another database?
0
Jesus RodriguezIT ManagerCommented:
Yes, check this link
http://support.microsoft.com/kb/301075

You must specify the connection string. I also I'm working with it connected with noble from IBM
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Jesus RodriguezIT ManagerCommented:
0
Éric MoreauSenior .Net ConsultantCommented:
0
Alex_WCommented:
You could use OLEDB, ODBC types of connection objects instead of SQL but the same logic applies.
0
ervolinoAuthor Commented:
OK.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.