Error in running the .exe file of my application
Hi All,
I have developed a migration tool for migrating data from MySQL to MSSQL using C#.Net . The application works fine while running it from the Visual Studio .net IDE, but problem occured when I tried to run it from the .exe file of my application. It shows the following
error -
Error: Object reference not set to an instance of an object.
at System.Data.Common.Odbc32.SQLFetch(HandleRef StatementHandle)
at System.Data.Odbc.OdbcDataReader.RetrieveKeyInfo(Bo olean needkeyinfo, QualifiedTableName qualifiedTableName)
at System.Data.Odbc.OdbcDataReader.BuildMetaDataInfo( )
at System.Data.Odbc.OdbcDataReader.GetSchemaTable()
at System.Data.Common.DbDataAdapter.FillSchemaFromCom mand(Object data, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillSchema(DataSe t dataSet, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillSchema(DataSe t dataSet, SchemaType schemaType, String srcTable)
at DBPorting.Table.getTableData(OdbcConnection Conn, String Qry, String tabname) ( This function is written by me & here is the code for your easy reference )-
public DataSet getTableData(OdbcConnection Conn, String Qry,String tabname)
{
/* The Qry is a selec query to select data from the table. Conn is OdbcConnection to connect to the source database.oCommand & adapter are private members of the class.*/
DataSet tabData =new DataSet();
oCommand.Connection=Conn;
oCommand.CommandText=Qry;
tabData.Reset();
adapter.SelectCommand=oCommand;
adapter.FillSchema(tabData,SchemaType.Source,tabna me);
adapter.Fill(tabData,tabname);
return tabData;
}
|