Internal .Net Framework Data Provider error 12

S

Steve

I have a situation very similar to the post
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic40421.aspx

This post was not resolved, so I wanted to see if anyone had any help.

I am using C# .NET 2.0 to get data out of a SQL Server 2005 database.
This code was migrated from .NET 1.1 to 2.0 almost a year ago. The
error I receive is not common, I have only seen this one time.
From the website ASP.NET 2.0, we first get the exception
'Internal .Net Framework Data Provider error 12' when doing a
SqlDataAdapter.Fill(DataTable).

Stack Trace:

System.InvalidOperationException: Internal .Net Framework Data
Provider error 12.
at
System.Data.ProviderBase.DbConnectionInternal.CreateReferenceCollection()
at
System.Data.ProviderBase.DbConnectionInternal.AddWeakReference(Object
value, Int32 tag)
at System.Data.SqlClient.SqlConnection.AddWeakReference(Object
value, Int32 tag)
at
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior, String resetOptionsString)
at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables,
Int32 startRecord, Int32 maxRecords, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)

After this error occurs, any database access just gives us the error
'Column 'column_name' does not belong to table table_name.',
regardless of what stored procedure we execute.

Here is our code that creates our connections and does the fill:

UpdateDataAdapterConnections();
if(dt == null) {
dt = new DataTable(myTablename);
}
mySqlDataAdapter.Fill(dt);
return dt;

protected void UpdateDataAdapterConnections() {
if (mySqlDataAdapter != null) {
SqlConnection sco = InitializeConnection();
SqlCommand sc = mySqlDataAdapter.SelectCommand;

if (sc != null) {
sc.Connection = sco;
}
sc = mySqlDataAdapter.UpdateCommand;
if (sc != null) {
sc.Connection = sco;
}
sc = mySqlDataAdapter.InsertCommand;
if (sc != null) {
sc.Connection = sco;
}
sc = mySqlDataAdapter.DeleteCommand;
if (sc != null) {
sc.Connection = sco;
}
}
}

protected virtual SqlConnection InitializeConnection() {
string connectString =
"server=" + DATABASE_SERVER_ADDRESS +
";Workstation ID=" + Environment.MachineName +
":" + UtilityMethods.Instance.CurrentIdentity.UserID +
";uid=" + UtilityMethods.Instance.CurrentPrinciple.DatabaseUsername
+
";pwd=" + UtilityMethods.Instance.CurrentPrinciple.DatabasePassword
+
";database=" + DATABASE_NAME + ";";

return new SqlConnection(connectString);
}

Any help would be greatly appreciated.
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top