Conectando banco DBC em C#
.NET Framework Data Provider for ODBC
EXEMPLO
Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\sistema\dados\banco.dbc;Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;Agora vamos conectar ao banco DBC:
EXEMPLO
string path = @"C:\sistema\dados\";
string cs = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB="+path+"banco.dbc;Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;";
OdbcConnection conn = new OdbcConnection(cs);
conn.Open();
string sql = @"SELECT * FROM cliente";
OdbcCommand cmd = new OdbcCommand(sql, conn);
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
conn.Close();
Comentários
Postar um comentário