Hi,
I m try to get a table from Microsoft Access.But, When i m try to get value with like method, i can't get table value.Null table returns.
For example My
table; TABLE NAME : INFO
| ID | Name | Adress | checked
1 John google.com true
Mysql command for getting John : SELECT name FROM INFO WHERE 1=1 AND Name LIKE 'J*';
My c# code:
DataTable dt = Dbconnect(sql);
datagrid.source=dt;
private DataTable Dbconnect(string command)
{
DataTable dtParameters = new DataTable();
string pathProject = "Var.mdb";
string sCnstr = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=" + pathProject +
";Jet OLEDB:Engine Type=5;Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
OleDbConnection conn = new OleDbConnection(sCnstr);
try
{
conn.Open();
OleDbDataAdapter my = new OleDbDataAdapter(command, conn);
my.Fill(dtParameters);
return dtParameters;
}
finally
{
conn.Close();
conn.Dispose();
}
ALSO
if i use sql command like "select * from INFO", i get table and value. This show that there is no problem about connection , Then i try to check query bulding in MS access , sql command returns correct result. But, in c# , result is not returned.