By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

invalid object sql error. maybe security??

P: n/a
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();
}
}
================================================== =====================

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

That's probably cause the user that created the object is different from the
one trying to use it now:
1- Go to enterprise manager , your DB, tables and see who is the owner of
the table
2- access the table using [db_user].tablename
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"mpriem" <sp**@mpriem.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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();
}
}
================================================== =====================

Nov 17 '05 #2

P: n/a
thanks, I will try that.
Another question:

When I use my access frontend I can see Kerberos events in the SQL
server eventlog.
When I use my c# frontend it is NTLM..
I cannot see the code behind the Access frontend because its a mde.

On my production workstation I am part of a w2k3 domain as is my sql
server. Why doesn't SSPI use the Kerberos provider??

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.