Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

got error when i try to run query on access using C# Winform program

$
0
0

hi

i have this code for run any query on access

 using (Conn = new OleDbConnection(Work_Connect))
 {
        Conn.Open();
 SQL = "select top 1 Code from MyTbl where ida = " + ida.Trim() + "";
 dsView = new DataSet();
 adp = new OleDbDataAdapter(SQL, Conn);
 adp.Fill(dsView, "MyTbl ");
 adp.Dispose();

}

but sometime i got this error:

Object reference not set to an instance of an object

or this error:

A Datatable named 'MyTbl' already belongs to this DataSet

i work on C# WinForm


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>