Hello all,
I am trying to connect to sqlserver on godaddy but facing so much trouble with the connection strings. I wanted to use C# but wasnt successfully in making a connection.
when i simply copy-pasted their vb-script connection strings sample.. it worked.
I tried to modify vb to c# accordingly with no success.
If anybody knows how to connect to godaddy sqlserver in C# please let me know..
Thankyou all in advance.

Their vbscript connection sample is as follows.. any little light on this might solve my problem..


'Sample Database Connection Syntax for ASP and SQL Server.

Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "whsql01.mesa1.secureserver.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

Do until oRs.EOF
   Response.Write ucase(fieldname) & ": " & oRs.Fields(fieldname)

Set oRs = nothing
Set oConn = nothing

9 Years
Discussion Span
Last Post by jerry32uk

To connect to SQL Server by C# application you need to use ADO.NET libraries

like importing and using System.Data and System.Data.SqlClient??

Made use of them too..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.