DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   How to connect sql database in asp.net using VB? (http://www.daniweb.com/forums/thread44879.html)

sathiya May 6th, 2006 2:13 am
How to connect sql database in asp.net using VB?
 
Hi all,

I would like to seek for some help from you on how to create a connection to a sql server database from an asp.net application using VB codes. I appreciate if you could provide me the relevant information about that with some sample codes.

Thank you.

mojio May 9th, 2006 12:04 am
Re: How to connect sql database in asp.net using VB?
 
            Dim strConn As String = "Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxx;Initial Catalog=Your database name;Data Source=Your server Name"
            Dim strsql As String = "Your SQL Command"
            Dim myconn As New OleDbConnection(strConn)
            Dim myCommand As New OleDbDataAdapter(strsql, myconn)

And don't forget to add
Imports System.Data.OleDb
Above your public class(On the top of the page

^^


All times are GMT -4. The time now is 12:05 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC