|
-
Sep 29th, 2004, 06:22 AM
#1
Thread Starter
Frenzied Member
Error, cannot find OleDb [* Resolved *]
Hello
I have a problem with the following code. It gives an error saying that the OleDb could not be found. I have included using System.OleDb at the top of my form. But still get the error.
VB Code:
cnnTeacher.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IBS Library System\LibrarySystem.mdb;Persist Security Info=False";
OleDbCommand cmdTeacher = cnnTeacher.CreateCommand();
cmdTeacher.CommandText = "Select * From Teacher Where TeacherID = txtIDNumber.text";
cmdTeacher.Parameters.Add("ID", OleDb.VarWChar, 40).Value = txtIDNumber.Text; //OleDb could not be found
OleDbDataAdapter daTeacher = new OleDbDataAdapter(cmdTeacher);
OleDbCommandBuilder cbTeacher = new OleDbCommandBuilder(daTeacher);
daTeacher.Fill(dtTeacher);
Many thanks in advance,
Steve
Last edited by steve_rm; Oct 4th, 2004 at 10:26 PM.
steve
-
Sep 29th, 2004, 09:57 AM
#2
-
Sep 29th, 2004, 11:43 AM
#3
Thread Starter
Frenzied Member
Hello,
thanks for your reply. This is the full error message:
The type or namespace name 'OleDb' could not be found (are you missing a using directive or an assembly reference?).
I hope you can help.
Steve
-
Sep 29th, 2004, 07:09 PM
#4
Sleep mode
Code:
using System.Data.OleDb;
-
Sep 30th, 2004, 05:44 AM
#5
Thread Starter
Frenzied Member
Hello Pirate,
Thanks for your reply. I am using
Code:
using System.Data.OleDb;
Any more help with this.
Thanks,
Steve
-
Oct 3rd, 2004, 05:11 AM
#6
Sleep mode
Check in the References item in the project solution explorer if you have System.Data . and also can you use fully qualified namespace in declaring OleDb objs ?
-
Oct 4th, 2004, 10:14 PM
#7
Thread Starter
Frenzied Member
Hello,
Thanks for your help. I managed to find the answer. I don't need the line to add parameters. So l deleted it and made a few changes and now it works fine. Below is the correct code for your own review.
VB Code:
cnnTeacher.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IBS Library System\LibrarySystem.mdb;Persist Security Info=False";
OleDbCommand cmdTeacher = cnnTeacher.CreateCommand();
cmdTeacher.CommandText = "Select * From Teacher Where TeacherID = '" + txtIDNumber.Text + "' ";
OleDbDataAdapter daTeacher = new OleDbDataAdapter(cmdTeacher);
OleDbCommandBuilder cbTeacher = new OleDbCommandBuilder(daTeacher);
daTeacher.Fill(dtTeacher)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|