I need help to connect to SQL server, i got Microsoft Visual Web Developer 2005 Express and SQL Server Management Studio Express
With SQL Server Management Studio Express i can make databases and create tables but i dunno how to connect via asp.net
Anyone could give me a helping hand?
Thanks for the help
- Gucchi
Hi
Following is the sample create_connection method that works for me.Hope this helps you.
ALL THE BEST
Chickoo
Sub create_Conn()
Dim oConnectionAs SqlConnection
Dim DAAs SqlDataAdapter
Dim DSAsNew DataSet
Dim sSQLAsString
Dim sConnAs SqlConnection =New SqlConnection("workstation id=<xxx>;packet size=4096;integrated security=SSPI;data source=<xxx >;persist security info=False;initial catalog=<Database Name>;Trusted_Connection=Yes")
sSQL = " SELECT * FROM MyDatabase"
DA =New SqlDataAdapter(sqlstr, sConn)
DA.Fill(DS, "MyTable")
MyGrid.DataSource = DS
MyGrid.DataBind()
sConn.Close()
EndSub
sql
No comments:
Post a Comment