G
gloria
So I created a MS DL that I know works. I can test the connection.
Provider=SQLOLEDB;Password=xxx;Persist Security Info=True;User
ID=xxx;Initial Catalog=olite3i;Data Source=niktraining
However, when I try to use this string in my code, I don't even get the
error in my catch. What am I doing wrong? If I use
SqlClient/SqlConnection, I at least can get the catch to work and the
error: "Keyword not supported: 'provider'." But I know my connect
string works because I can test it.
What am I doing wrong?
Thanks!
--gloria
---------------
using System;
using System.Data;
using System.Data.OleDb;
....
string connStr = "Provider=SQLOLEDB;Password=xxxx;Persist Security
Info=True;User ID=xxx;Initial Catalog=olite3i;Data Source=niktraining";
Console.WriteLine("connStr: " + connStr);
try
{
OleDbConnection cn = new OleDbConnection();
cn.ConnectionString = connStr;
cn.Open();
} catch (Exception ex) {
Console.WriteLine("Attepmet to connect failed.\n" + ex.Message);
}
Provider=SQLOLEDB;Password=xxx;Persist Security Info=True;User
ID=xxx;Initial Catalog=olite3i;Data Source=niktraining
However, when I try to use this string in my code, I don't even get the
error in my catch. What am I doing wrong? If I use
SqlClient/SqlConnection, I at least can get the catch to work and the
error: "Keyword not supported: 'provider'." But I know my connect
string works because I can test it.
What am I doing wrong?
Thanks!
--gloria
---------------
using System;
using System.Data;
using System.Data.OleDb;
....
string connStr = "Provider=SQLOLEDB;Password=xxxx;Persist Security
Info=True;User ID=xxx;Initial Catalog=olite3i;Data Source=niktraining";
Console.WriteLine("connStr: " + connStr);
try
{
OleDbConnection cn = new OleDbConnection();
cn.ConnectionString = connStr;
cn.Open();
} catch (Exception ex) {
Console.WriteLine("Attepmet to connect failed.\n" + ex.Message);
}