hi,

I am having some troubles while trying to connect a database which uses mssql server. Every attempt results with the error "[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied."

[INDENT]OleDbConnection conn = new OleDbConnection();[/INDENT]
            conn.ConnectionString = "Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=voters;Data Source=T_YALTHIS\\SQLEXPRESS;Workstation Id=T_YALTHIS;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False";
            string myStr="select email from idMail";
            OleDbCommand myCommand = new OleDbCommand(myStr, conn);
    
            conn.Open();

database name: voters
computer name: t_yalthis
instance name: SQLEXPRESS

I can connect when I run the program on the computer that the database created, but not from a different one.

make sure the server name is right.

try this

sqlconnection con=new sqlconnection ("provider=t_yalthis/sqlexpress,datasource=voters,Integrated Security=SSPI)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.