TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Alex Calidguid
1.5k
192
5.2k
Can't load data from .dbf file into Datagridview using c#
Dec 15 2013 4:03 AM
Hello guys,
I have some problem of loading data from .dbf file into datagrideview using c#
here's the first code that I written
try
{
string odbcConnect = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = "+ lblpath.Text + "; Entended Properties = dDASE IV; User ID=;Password=";
OleDbConnection con = new OleDbConnection();
con.ConnectionString = odbcConnect;
con.Open();
string connecData = "select * from Attendance";
OleDbDataAdapter da = new OleDbDataAdapter(connecData, con);
da.Fill(dsData);
con.Close();
DgvGetData.DataSource = dsData.Tables[0];
} catch(OleDbException exp){
MessageBox.Show("Error: " + exp.Message);
}
the second code:
void Loaddata()
{
OdbcConnection oConn = new OdbcConnection();
oConn.ConnectionString = ("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277; Dbq=D:\\Attendance;");
Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;";
oConn.Open();
OdbcCommand oCmd = oConn.CreateCommand();
oCmd.CommandText = @"SELECT badgenon,badgename empno, date FROM Attendance.dbf";
DataTable dt = new DataTable();
dt.Load(oCmd.ExecuteReader());
oConn.Close();
DgvGetData.DataSource = dt;
}
Its gave me nothing just an errors
Thanks you,
Reply
Answers (
1
)
systax error
send Email to multiple users using exhchange