By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

problem with .aspx.vb code

P: n/a
I'm working on a problem with a form with 6 textboxes and a submit
button for adding data to an Access database.I changed a few things
and got it down to 1 error!. I have a Sub
Page_Load and a Sub btnAdd:
(It still doesn't like the 'SourceVersion' in the Sub Page_Load).
Also
I viewed the .aspx in the browser and got an error which I posted
complete at the bottom of this post). Thanks for any clues... I'm
almost there!!

Imports System.Data
Imports System.Data.OleDb
Public Class Default5
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As OleDbConnection = _
New OleDbConnection("Data Source=(local);" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
If IsPostBack Then
Dim cmdSelect As OleDbCommand = _
cnn.CreateCommand()
cmdSelect.CommandType = CommandType.Text
cmdSelect.CommandText = _
"SELECT (Asset Number, Description, Serial_Number, Mfg, Asset Type,
RDCnumber) FROM Assets"
Dim cmdInsert As OleDbCommand = _
cnn.CreateCommand()
cmdInsert.CommandType = CommandType.Text
cmdInsert.CommandText = _
"INSERT INTO Assets " & _
"(Asset Number, Description, Serial_Number, Mfg, Asset Type,
RDCnumber) " & _
"VALUES(@Asset_Number, @Description, @Serial_Number, @Mfg,
@AssetType,
@RDCnumber"
cmdInsert.Parameters.Add("@txtAsset_Number",
OleDbType.Double, 12, "Asset_Number")
cmdInsert.Parameters.Add("@txtDescription",
OleDbType.WChar, 40, "Description")
cmdInsert.Parameters.Add("@txtSerial_Number",
OleDbType.WChar, 30, "Serial_Number")
cmdInsert.Parameters.Add("@txtMfg", OleDbType.WChar, 30,
"Mfg")
cmdInsert.Parameters.Add("@txtAssetType",
OleDbType.WChar,
30, "AssetType")
cmdInsert.Parameters.Add("@txtRDCNumber",
OleDbType.WChar,
30, "RDCnumber")
Dim SourceVersion As DataRowVersion
SourceVersion = DataRowVersion.Original
da.SelectCommand = cmdSelect
da.InsertCommand = cmdInsert
da.Fill(ds, "Assets")
End If
End Sub
Private Sub btnAdd_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
Dim dr As DataRow = ds.Tables("Assets").NewRow()
dr(0) = txtAsset_Number.Text
dr(1) = txtDescription.Text
dr(2) = txtSerial_Number.Text
dr(3) = txtMfg.Text
dr(4) = txtAssetType.Text
dr(5) = txtRDCnumber.Text
ds.Tables("Assets").Rows.Add(dr)
da.Update(ds, "Assets")
End Sub
End Class
__________________________
Server Error in '/' Application.
---------------------------------------------------------------------------*-----
An OLE DB Provider was not specified in the ConnectionString. An
example would be, 'Provider=SQLOLEDB;'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An OLE DB Provider was
not specified in the ConnectionString. An example would be,
'Provider=SQLOLEDB;'.
Source Error:
Line 5: Private Sub Page_Load(ByVal sender As System.Object, _
Line 6: ByVal e As System.EventArgs) Handles MyBase.Load
Line 7: Dim cnn As OleDbConnection = _
Line 8: New OleDbConnection("Data Source=(local);" & _
Line 9: "Initial Catalog=Assets;Integrated Security=SSPI")
Source File: E:\kunden\homepages\26\d190091667\Default5.aspx.vb
Line: 7
Stack Trace:
[ArgumentException: An OLE DB Provider was not specified in the
ConnectionString. An example would be, 'Provider=SQLOLEDB;'.]
System.Data.OleDb.OleDbConnectionString.ValidatePr ovider(String
progid) +1044303
System.Data.OleDb.OleDbConnectionString.ValidateCo nnectionString(String
connectionString) +221
System.Data.OleDb.OleDbConnectionString..ctor(Stri ng
connectionString, Boolean validate) +271
System.Data.OleDb.OleDbConnectionFactory.CreateCon nectionOptions(String
connectionString, DbConnectionOptions previous) +36
System.Data.ProviderBase.DbConnectionFactory.GetCo nnectionPoolGroup(String
connectionString, DbConnectionPoolGroupOptions poolOptions,
DbConnectionOptions& userConnectionOptions) +125
System.Data.OleDb.OleDbConnection.ConnectionString _Set(String
value) +56
System.Data.OleDb.OleDbConnection.set_ConnectionSt ring(String
value) +4
System.Data.OleDb.OleDbConnection..ctor(String connectionString)
+21
Default5.Page_Load(Object sender, EventArgs e) in E:\kunden
\homepages\26\d190091667\Default5.aspx.vb:7
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061

Aug 8 '07 #1
Share this Question
Share on Google+
13 Replies


P: n/a
<snip>
>
Imports System.Data
Imports System.Data.OleDb
Public Class Default5
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As OleDbConnection = _
New OleDbConnection("Data Source=(local);" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
Dim ds As DataSet = New DataSet()
</snip>
Try

Dim cnn As OleDbConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=(local);
Initial Catalog=Assets;Integrated Security=SSPI")

But this still wont work, because as far as I can see, you dont set the
path to the access file anywhere.
Aug 8 '07 #2

P: n/a
The database resides in the App_Data folder on my web provider's
server where my website objects reside. Do I need to put the path to
the URL? Thanks!
>
But this still wont work, because as far as I can see, you dont set the
path to the access file anywhere.

Aug 8 '07 #3

P: n/a
I changed the filepath and was able to get it to have no errors. But
when I ran my .aspx file I got the following error shown below my
code. Is the line "If IsPostBack" an issue? Thanks

Imports System.Data
Imports System.Data.OleDb
Public Class Default5
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As OleDbConnection = _
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=(www.juggernautical.com\App_Data\Lowes.mdb) ;" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
If IsPostBack Then
Dim cmdSelect As OleDbCommand = _
cnn.CreateCommand()
cmdSelect.CommandType = CommandType.Text
cmdSelect.CommandText = _
"SELECT (Asset Number, Description, Serial_Number, Mfg, Asset Type,
RDCnumber) FROM Assets"
Dim cmdInsert As OleDbCommand = _
cnn.CreateCommand()
cmdInsert.CommandType = CommandType.Text
cmdInsert.CommandText = _
"INSERT INTO Assets " & _
"(Asset Number, Description, Serial_Number, Mfg, Asset Type,
RDCnumber) " & _
"VALUES(@Asset_Number, @Description, @Serial_Number, @Mfg, @AssetType,
@RDCnumber"
cmdInsert.Parameters.Add("@txtAsset_Number",
OleDbType.Double, 12, "Asset_Number")
cmdInsert.Parameters.Add("@txtDescription",
OleDbType.WChar, 40, "Description")
cmdInsert.Parameters.Add("@txtSerial_Number",
OleDbType.WChar, 30, "Serial_Number")
cmdInsert.Parameters.Add("@txtMfg", OleDbType.WChar, 30,
"Mfg")
cmdInsert.Parameters.Add("@txtAssetType", OleDbType.WChar,
30, "AssetType")
cmdInsert.Parameters.Add("@txtRDCNumber", OleDbType.WChar,
30, "RDCnumber")
Dim SourceVersion As DataRowVersion
SourceVersion = DataRowVersion.Original
da.SelectCommand = cmdSelect
da.InsertCommand = cmdInsert
da.Fill(ds, "Assets")
End If
End Sub
Private Sub btnAdd_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
Dim dr As DataRow = ds.Tables("Assets").NewRow()
dr(0) = txtAsset_Number.Text
dr(1) = txtDescription.Text
dr(2) = txtSerial_Number.Text
dr(3) = txtMfg.Text
dr(4) = txtAssetType.Text
dr(5) = txtRDCnumber.Text
ds.Tables("Assets").Rows.Add(dr)
da.Update(ds, "Assets")
End Sub
End Class
__________________________________________________ _____________
Server Error in '/' Application.
--------------------------------------------------------------------------------

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE
DB operation generated errors. Check each OLE DB status value, if
available. No work was done.

Source Error:

Line 33: da.SelectCommand = cmdSelect
Line 34: da.InsertCommand = cmdInsert
Line 35: da.Fill(ds, "Assets")
Line 36: End If
Line 37: End Sub

Source File: E:\kunden\homepages\26\d190091667\Default5.aspx.vb
Line: 35

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.OleDbServicesWrapper.GetDataSour ce(OleDbConnectionString
constr, DataSourceWrapper& datasrcWrapper) +209

System.Data.OleDb.OleDbConnectionInternal..ctor(Ol eDbConnectionString
constr, OleDbConnection connection) +118

System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningObject) +53

System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup) +27

System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection) +47

System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +83
Default5.Page_Load(Object sender, EventArgs e) in E:\kunden
\homepages\26\d190091667\Default5.aspx.vb:35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061
_______________________________

On Aug 8, 6:09 am, Mick Walker <materiali...@privacy.netwrote:
<snip>
Imports System.Data
Imports System.Data.OleDb
Public Class Default5
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As OleDbConnection = _
New OleDbConnection("Data Source=(local);" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
Dim ds As DataSet = New DataSet()

</snip>
Try

Dim cnn As OleDbConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=(local);
Initial Catalog=Assets;Integrated Security=SSPI")

But this still wont work, because as far as I can see, you dont set the
path to the access file anywhere.

Aug 8 '07 #4

P: n/a
slinky wrote:
I changed the filepath and was able to get it to have no errors. But
when I ran my .aspx file I got the following error shown below my
code. Is the line "If IsPostBack" an issue? Thanks
>
Use Server.MapPath or try the reletive path to the data file.
Aug 8 '07 #5

P: n/a
I've used Server.MapPath with reading an XML file into a dataset, but
am unsure how to phrase it for an Access Database. What I used for XML
was:

Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))

So I'm unsure where to go from here. Here's what I'm coming up with
for the Connection for Page_Load:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=(Server.MapPath\App_Data\Lowes.mdb);" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

But do I need to do anything in the code for btnADD ?

Private Sub btnAdd_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
Dim dr As DataRow = ds.Tables("Assets").NewRow()
dr(0) = txtAsset_Number.Text
dr(1) = txtDescription.Text
dr(2) = txtSerial_Number.Text
dr(3) = txtMfg.Text
dr(4) = txtAssetType.Text
dr(5) = txtRDCnumber.Text
ds.Tables("Assets").Rows.Add(dr)
da.Update(ds, "Assets")
End Sub

I get no errors till I view in browser:
Source Error:

Line 33: da.SelectCommand = cmdSelect
Line 34: da.InsertCommand = cmdInsert
Line 35: da.Fill(ds, "Assets")
Line 36: End If
Line 37: End Sub

Line 35 is flagged in the browser as a problem.

On Aug 8, 9:43 am, Mick Walker <materiali...@privacy.netwrote:
slinky wrote:
I changed the filepath and was able to get it to have no errors. But
when I ran my .aspx file I got the following error shown below my
code. Is the line "If IsPostBack" an issue? Thanks

Use Server.MapPath or try the reletive path to the data file.

Aug 8 '07 #6

P: n/a
slinky wrote:
I've used Server.MapPath with reading an XML file into a dataset, but
am unsure how to phrase it for an Access Database. What I used for XML
was:

Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))

So I'm unsure where to go from here. Here's what I'm coming up with
for the Connection for Page_Load:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=(Server.MapPath\App_Data\Lowes.mdb);" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
Server.MapPath is a method, not a folder. It turns a virtual path into a
physical path, so you supply it with a virtual path. A virtual path uses
/, not \.

Use this to get the physical path to the database file:

Server.MapPath("~/App_Data/Lowes.mdb")

Concatenate this into the connection string.
But do I need to do anything in the code for btnADD ?

Private Sub btnAdd_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim ds As DataSet = New DataSet()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
Dim dr As DataRow = ds.Tables("Assets").NewRow()
dr(0) = txtAsset_Number.Text
dr(1) = txtDescription.Text
dr(2) = txtSerial_Number.Text
dr(3) = txtMfg.Text
dr(4) = txtAssetType.Text
dr(5) = txtRDCnumber.Text
ds.Tables("Assets").Rows.Add(dr)
da.Update(ds, "Assets")
End Sub
You need to supply a database connection to the DataAdapter, otherwise
it doesn't know what to update.
I get no errors till I view in browser:
Source Error:

Line 33: da.SelectCommand = cmdSelect
Line 34: da.InsertCommand = cmdInsert
Line 35: da.Fill(ds, "Assets")
Line 36: End If
Line 37: End Sub

Line 35 is flagged in the browser as a problem.
What "problem"? You should include the error message.

--
Göran Andersson
_____
http://www.guffa.com
Aug 8 '07 #7

P: n/a
I put this into my doce for the Page_Load and the btnAdd:

Dim cnn As OleDbConnection = _
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Server.MapPath(~/App_Data/Lowes.mdb));" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

I get no errors till I launch the browser and here's the complete
message.
I see below what I believe to be the physical path on my provider's
server:

E:\kunden\homepages\26\d190091667\Default5.aspx.vb

The actual URL to access my site to the page 'Default5.aspx (not the
module) is:
www.juggernautical.com/default5.aspx

__________________________________________________ ____________________________________________

Server Error in '/' Application.
--------------------------------------------------------------------------------

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE
DB operation generated errors. Check each OLE DB status value, if
available. No work was done.

Source Error:

Line 33: da.SelectCommand = cmdSelect
Line 34: da.InsertCommand = cmdInsert
Line 35: da.Fill(ds, "Assets") <<< This line
is in Red on screen
Line 36: End If
Line 37: End Sub

Source File: E:\kunden\homepages\26\d190091667\Default5.aspx.vb
Line: 35

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.OleDbServicesWrapper.GetDataSour ce(OleDbConnectionString
constr, DataSourceWrapper& datasrcWrapper) +209

System.Data.OleDb.OleDbConnectionInternal..ctor(Ol eDbConnectionString
constr, OleDbConnection connection) +118

System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningObject) +53

System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup) +27

System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection) +47

System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +83
Default5.Page_Load(Object sender, EventArgs e) in E:\kunden
\homepages\26\d190091667\Default5.aspx.vb:35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061


>
What "problem"? You should include the error message.

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -

Aug 8 '07 #8

P: n/a
slinky wrote:
I put this into my doce for the Page_Load and the btnAdd:

Dim cnn As OleDbConnection = _
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Server.MapPath(~/App_Data/Lowes.mdb));" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

I get no errors till I launch the browser and here's the complete
message.
I see below what I believe to be the physical path on my provider's
server:

E:\kunden\homepages\26\d190091667\Default5.aspx.vb

The actual URL to access my site to the page 'Default5.aspx (not the
module) is:
www.juggernautical.com/default5.aspx

__________________________________________________ ____________________________________________

Server Error in '/' Application.
--------------------------------------------------------------------------------

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Your select query is incorrect. If you have spaces in your field names,
you have to encode the names in brackets.

"SELECT ([Asset Number], Description, Serial_Number, Mfg, [Asset Type],
RDCnumber) FROM Assets"

--
Göran Andersson
_____
http://www.guffa.com
Aug 8 '07 #9

P: n/a
OK I double checked and corrected any incident of misspelling or
brackets missing and corrected those. But still the browser brings up
this: (And I know nothing about
reading a stack)

Also, do I have this syntaxed correctly (ignore the '& _'s as they are
just from reformat on paste)?:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Server.MapPath(~/App_Data/Lowes.mdb));" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
__________________________________________________ _
Server Error in '/' Application.
--------------------------------------------------------------------------------

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Multiple-step OLE
DB operation generated errors. Check each OLE DB status value, if
available. No work was done.

Source Error:
Line 33: da.SelectCommand = cmdSelect
Line 34: da.InsertCommand = cmdInsert
Line 35: da.Fill(ds, "Assets")
Line 36: End If
Line 37: End Sub
Source File: E:\kunden\homepages\26\d190091667\Default5.aspx.vb
Line: 35

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.OleDbServicesWrapper.GetDataSour ce(OleDbConnectionString
constr, DataSourceWrapper& datasrcWrapper) +209

System.Data.OleDb.OleDbConnectionInternal..ctor(Ol eDbConnectionString
constr, OleDbConnection connection) +118

System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningObject) +53

System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup) +27

System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection) +47

System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +83
Default5.Page_Load(Object sender, EventArgs e) in E:\kunden
\homepages\26\d190091667\Default5.aspx.vb:35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061
>
Your select query is incorrect. If you have spaces in your field names,
you have to encode the names in brackets.

"SELECT ([Asset Number], Description, Serial_Number, Mfg, [Asset Type],
RDCnumber) FROM Assets"

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -

Aug 8 '07 #10

P: n/a
slinky wrote:
OK I double checked and corrected any incident of misspelling or
brackets missing and corrected those.
And now it looks like?
But still the browser brings up
this: (And I know nothing about
reading a stack)

Also, do I have this syntaxed correctly (ignore the '& _'s as they are
just from reformat on paste)?:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=Server.MapPath(~/App_Data/Lowes.mdb));" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
No. You have put Server.MapPath inside the string. There it doesn't mean
anything at all. Concatenate the return value from the method into the
string:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

--
Göran Andersson
_____
http://www.guffa.com
Aug 8 '07 #11

P: n/a
I tried this exact paste:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

And it didn't like the format so I redid it to:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data &
_
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

And that didn't work either, so I tried just one long string:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" "Initial
Catalog=Assets;Integrated Security=SSPI")

or:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath & _
(~/App_Data/Lowes.mdb) & ";" "Initial Catalog=Assets;Integrated
Security=SSPI")

Then it doesn't allow the "~" symbol. I see your point about putting
Server.MapPath outside the rest of the code, but I tried these
variations and couldn't get the syntax to be accepted.

Any ideas of what I'm doing wrong? And I really do appreciate your
help for this newbie!
On Aug 8, 6:42 pm, Göran Andersson <gu...@guffa.comwrote:
No. You have put Server.MapPath inside the string. There it doesn't mean
anything at all. Concatenate the return value from the method into the
string:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

--
Göran Andersson
_____http://www.guffa.com

Aug 9 '07 #12

P: n/a
slinky wrote:
I tried this exact paste:

New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")
That's only two lines, not three. I just edited the code that you posted.

I forgot the quotes around the string in the call to MapPath.

You really should read up a bit on the basic elements in the
programming, like strings and method calls. If you just copy and paste
code that you don't understand, you won't learn anything.

Code posted in newsgroups and articles often has small mistakes like
this, if you don't understand the code you can't fix those mistakes and
use the code.

--
Göran Andersson
_____
http://www.guffa.com
Aug 10 '07 #13

P: n/a
On Aug 10, 10:52 pm, Göran Andersson <gu...@guffa.comwrote:
slinky wrote:
I tried this exact paste:
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(~/App_Data/Lowes.mdb) & ";" & _
"Initial Catalog=Assets;Integrated Security=SSPI")

That's only two lines, not three. I just edited the code that you posted.

I forgot the quotes around the string in the call to MapPath.

You really should read up a bit on the basic elements in the
programming, like strings and method calls. If you just copy and paste
code that you don't understand, you won't learn anything.

Code posted in newsgroups and articles often has small mistakes like
this, if you don't understand the code you can't fix those mistakes and
use the code.

--
Göran Andersson
_____http://www.guffa.com
Agree with Göran.

http://groups.google.com/group/micro...fa4e582f3bc1e6

Aug 10 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.