| Author |
Topic Search Topic Options
|
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Topic: Multiple-Step OLE DB Operation Errors.... Posted: 26 August 2004 at 10:55am |
|
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
My code-behind looks like this:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.OleDb
Public Class BasicAuthorList
Inherits Page
Protected listAuthor as DataList
' Replaced Provider=SQLOLEDB.1 b/c it wasn't functioning.
Private ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=localhost;Initial
Catalog=pubs;Integrated Security=SSPI"
Private Sub Page_Load (sender as Object, e as EventArgs) Handles MyBase.Load
' Create and fill a DataSet.
Dim SQL as String
SQL = "SELECT * FROM Authors"
Dim con as New OleDbConnection(ConnectionString)
Dim cmd as New OleDbCommand(SQL, con)
Dim adapter as New OleDbDataAdapter(cmd)
Dim Pubs as New DataSet()
con.Open()
adapter.Fill(Pubs, "Authors")
con.Close()
' Bind the DataSet, and activate the data binds for the page.
listAuthor.DataSource = Pubs.Tables("Authors")
Me.DataBind()
End Sub
End Class
Any ideas?
David.
|
|
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2004 at 11:01am |
|
On what line do you get the error?
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2004 at 11:16am |
It doesn't give me a line...It just gives me a stack trace:
[OleDbException (0x80040e21): Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.] System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20 System.Data.OleDb.OleDbConnection.CreateProviderError(Int32 hr) +23 System.Data.OleDb.OleDbConnection.CreateProvider(OleDbConnec tionString constr) +81 System.Data.OleDb.OleDbConnection.Open() +203 BasicAuthorList.Page_Load(Object sender, EventArgs e) +112 System.Web.UI.Control.OnLoad(EventArgs e) +55 System.Web.UI.Control.LoadRecursive() +27 System.Web.UI.Page.ProcessRequestMain() +731
|
|
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2004 at 12:18pm |
Why are you trying to connect to SQL Server with System.Data.OleDb?
Try this code: (not tested)
Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Imports System.Data Imports System.Data.SqlClient
Public Class BasicAuthorList Inherits Page
Protected listAuthor as DataList ' Replaced Provider=SQLOLEDB.1 b/c it wasn't functioning. Private ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=localhost;Initial Catalog=pubs;Integrated Security=SSPI"
Private Sub Page_Load (sender as Object, e as EventArgs) Handles MyBase.Load ' Create and fill a DataSet. Dim SQL as String SQL = "SELECT * FROM Authors" Dim con as New SqlConnection(ConnectionString) Dim cmd as New SqlCommand(SQL, con) Dim adapter as New SqlDataAdapter(cmd) Dim Pubs as New DataSet() con.Open() adapter.Fill(Pubs, "Authors") con.Close()
' Bind the DataSet, and activate the data binds for the page. listAuthor.DataSource = Pubs.Tables("Authors") Me.DataBind() End Sub End Class
|
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2004 at 1:50pm |
Hmmm...Well, I tried that and things looked hopeful but in the end it told me:
[ArgumentException: Keyword not supported: 'provider'.] System.Data.Common.DBConnectionString.ParseInternal(Char[] connectionString, UdlSupport checkForUdl, NameValuePair& keychain) +1095 System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl) +114 System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +13 System.Data.SqlClient.SqlConnectionString.ParseString(String connectionString) +87 System.Data.SqlClient.SqlConnection.set_ConnectionString(Str ing value) +11 System.Data.SqlClient.SqlConnection..ctor(String connectionString) +134 BasicAuthorList.Page_Load(Object sender, EventArgs e) +37 System.Web.UI.Control.OnLoad(EventArgs e) +55 System.Web.UI.Control.LoadRecursive() +27 I think that perhaps the problem is with the database and not with the code? Just a thought? Is there any way for me to figure out if maybe its just having problems connecting to pubs? System.Web.UI.Page.ProcessRequestMain() +731
|
|
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2004 at 2:43pm |
its just the connection string that is wrong, try this one
Server=localhost;User ID=sa;Password=password;Database=Pubs;
|
 |
Bunce
Senior Member
Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
|
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2004 at 12:59am |
I think the first thing that needs to be asked is:
What database are you trying to connect to?
|
|
There have been many, many posts made throughout the world...
This was one of them.
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2004 at 9:33am |
|
I am attempting to connect to the pubs database. I have replaced the code as you suggested Mart, but now its telling me:
Keyword not supported 'provider.'
I believe this is talkiing about
Private ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Server=localhost;User
ID=sa;Password=password;Database=pubs"
David.
|
|
|
 |