Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 15, 2012 01:11 AM by Decker Dong - MSFT
Member
232 Points
146 Posts
Aug 13, 2012 01:24 AM|LINK
hi
I have a strange error when execute reader againest access database for simple sql statement select * from table1
I get error says
System.Data.OleDb.OleDbException: Unspecified error
I could not find any error in the code
I got a work arround to this problem by Copy all the records from the table (table1), delete all records then paste the records
Then it works fine. After new records added to the table I got the same error
What should I do to get rid of this problem completly
All-Star
31798 Points
6499 Posts
Aug 13, 2012 01:36 AM|LINK
Aug 13, 2012 03:13 AM|LINK
What do u mean by open and close the database? it is ms-access file
here is a portion of the code
Dim mycommand As New OleDbCommand
mycommand.Connection = myconnection mycommand.CommandType = Data.CommandType.Text
mycommand.CommandText = "SELECT * from Table1"
Try myconnection.Open()
Dim rd As OleDbDataReader = mycommand.ExecuteReader
gvQuestions.DataSource = rd gvQuestions.DataBind()
Catch ex As Exception Response.Write(ex.Message) Finally myconnection.Close() End Try
35986 Points
6550 Posts
Aug 13, 2012 09:07 AM|LINK
itismesa here is a portion of the code
But an important part is missing. show the code where myconnection is created?
Aug 14, 2012 03:04 AM|LINK
Dim myconnection As New OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; data source= " & Server.MapPath("~/mydb.accdb"))
Aug 14, 2012 03:18 AM|LINK
118619 Points
18779 Posts
Aug 15, 2012 01:11 AM|LINK
itismesa System.Data.OleDb.OleDbException: Unspecified error
Please make sure that your Access's accdb isn't in the state of Open, and maybe it's the problem that will occur this thing.
And I suggest you using "using……" block to close the OleDbConnection after using that.
Reguards!
itismesa
Member
232 Points
146 Posts
System.Data.OleDb.OleDbException: Unspecified error
Aug 13, 2012 01:24 AM|LINK
hi
I have a strange error when execute reader againest access database for simple sql statement
select * from table1
I get error says
System.Data.OleDb.OleDbException: Unspecified error
I could not find any error in the code
I got a work arround to this problem by Copy all the records from the table (table1), delete all records then paste the records
Then it works fine. After new records added to the table I got the same error
What should I do to get rid of this problem completly
oned_gk
All-Star
31798 Points
6499 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 13, 2012 01:36 AM|LINK
itismesa
Member
232 Points
146 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 13, 2012 03:13 AM|LINK
What do u mean by open and close the database? it is ms-access file
here is a portion of the code
Dim mycommand As New OleDbCommand
mycommand.Connection = myconnection
mycommand.CommandType = Data.CommandType.Text
mycommand.CommandText = "SELECT * from Table1"
Try
myconnection.Open()
Dim rd As OleDbDataReader = mycommand.ExecuteReader
gvQuestions.DataSource = rd
gvQuestions.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
Finally
myconnection.Close()
End Try
hans_v
All-Star
35986 Points
6550 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 13, 2012 09:07 AM|LINK
But an important part is missing. show the code where myconnection is created?
itismesa
Member
232 Points
146 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 14, 2012 03:04 AM|LINK
Dim myconnection As New OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; data source= " & Server.MapPath("~/mydb.accdb"))
oned_gk
All-Star
31798 Points
6499 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 14, 2012 03:18 AM|LINK
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: System.Data.OleDb.OleDbException: Unspecified error
Aug 15, 2012 01:11 AM|LINK
Please make sure that your Access's accdb isn't in the state of Open, and maybe it's the problem that will occur this thing.
And I suggest you using "using……" block to close the OleDbConnection after using that.
Reguards!