I am developing a C# windows application which will act as an frontend
for a SQL 2000 database.
I am using a laptop with SQl 2000 workgroup edition (sp4). SQL is setup
to use windows authentication.
When I use my application on my laptop everything works.
When I use my application on a SQL server (SQL 2000 enterprise sp4) in
my organisation I get the error : "invalid object <tablename>"
The database is a database generated by logman.exe and filled with
performance/capacity figures. The database structure is always the
same.
I am using the following code for the connection:
================================================== ====================
public static SqlConnection GetConnection(string a, string b,string
c)
{
string strConn;
if(c.Length !=0)
{
strConn = c;
}
else
{
strConn = "Data Source=" + a +";Initial Catalog=" + b +
";Integrated Security=SSPI;";
/* string strConn = "Integrated Security=SSPI;Initial Catalog = " +
c +
";Data Source=" + a + ";";*/
}
System.Windows.Forms.MessageBox.Show(strConn);
SqlConnection objConnection = null;
try
{
objConnection = new SqlConnection(strConn);
objConnection.Open();
}
catch(Exception ex)
{
objConnection = null;
System.Windows.Forms.MessageBox.Show("Fout bij verbinden : " +
ex.Message,"Connection fout");
}
finally
{
if (objConnection != null)
{
objConnection.Close();
}
}
return objConnection;
}
================================================== =====================
The select statement I use is = SELECT MachineName FROM CounterDetails
GROUP BY MachineName
My ConnectionString is = "Data Source=" + a +";Initial Catalog=" + b +
";Integrated Security=SSPI;" (a = servername) (b = databasename);
My domainaccount has the dbowner role on the database. And
serverconnection goes ok!
The only strange thing I see in the eventlog is that my authentication
to the corporate SQL server is performed by NTLM. Why not by kerberos??
When I use a access frontend I always see Kerberos events in the
eventlog. Could this be a security issue? Or am I using the wrong
query?
code for query:
================================================== =====================
public static DataSet ExecuteQuery(SqlConnection objConnection,
SqlDataAdapter objAdapter, string strQuery)
{
objConnection.Open();
System.Windows.Forms.MessageBox.Show(strQuery);
objAdapter.SelectCommand = new SqlCommand(strQuery,objConnection);
DataSet objDataSet = new DataSet();
try
{
objAdapter.Fill(objDataSet,"x");
objConnection.Close();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show("SQL: " + ex.Message,"SQL
fout");
}
finally
{
if (objConnection != null)
{
objConnection.Close();
}
}
return objDataSet;
objDataSet.Dispose();
}
}
================================================== =====================