[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB 2008

Posted on 2011-10-20
8
Medium Priority
?
202 Views
Last Modified: 2012-05-12
gentlemen,
What is, and what are the forms of connection objects in Visual Bisic 2008?
grateful
0
Comment
Question by:ervolino
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 8

Accepted Solution

by:
Alex_W earned 260 total points
ID: 37001332
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
 

Author Comment

by:ervolino
ID: 37001470
Thank you.
I could use another database?
0
 
LVL 13

Assisted Solution

by:Jesus Rodriguez
Jesus Rodriguez earned 240 total points
ID: 37001825
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Assisted Solution

by:Jesus Rodriguez
Jesus Rodriguez earned 240 total points
ID: 37001829
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 37001837
0
 
LVL 8

Expert Comment

by:Alex_W
ID: 37005581
You could use OLEDB, ODBC types of connection objects instead of SQL but the same logic applies.
0
 

Author Closing Comment

by:ervolino
ID: 37065913
OK.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

873 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