Hi
I followed the Web Matrix guided tour and came to the "ASP.NET Pages with
Data
(Microsoft Access)" part.
There is really not much you can do wrong there, but for some reason, the
INSERT part gives me an error. Here is the function that fails (appart from
the exception handling everything is generated by the code wizard):
Function InsertManufacturer(ByVal manufacturerCode As String, ByVal name As
String, ByVal address As String, ByVal webSite As String) As Integer
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\MatrixProjects.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )
Dim queryString As String = "INSERT INTO [Manufacturer]
([ManufacturerCode], [Name], [Address], [WebSite]) VALUES (@ManufacturerCode,
@Name, @Address, @WebSite)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_manufacturerCode As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_manufacturerCode.ParameterName = "@ManufacturerCode"
dbParam_manufacturerCode.Value = manufacturerCode
dbParam_manufacturerCode.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_manufacturerCode)
Dim dbParam_name As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_name.ParameterName = "@Name"
dbParam_name.Value = name
dbParam_name.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_name)
Dim dbParam_address As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_address.ParameterName = "@Address"
dbParam_address.Value = address
dbParam_address.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_address)
Dim dbParam_webSite As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_webSite.ParameterName = "@WebSite"
dbParam_webSite.Value = webSite
dbParam_webSite.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_webSite)
Dim rowsAffected As Integer = 0
dim ex as exception ' To see what error it is
dbConnection.Open
Try
rowsAffected = dbCommand.ExecuteNonQuery
Catch ex
msgLabel.Text = "Database Error: <br>" & ex.source & "<br>" & ex.message
& "<br>" & ex.stacktrace
msgLabel.Visible = true
Finally
dbConnection.Close
End Try
Return rowsAffected
End Function
The ex.message returns (danish):
"Handlingen skal bruge en opdaterbar forespørgsel"
which means something to the effect:
"Action needs an updatable query"
The ex.stacktrace says:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at ASP.addManufacturer_aspx.InsertManufacturer(String manufacturerCode,
String name, String address, String webSite) in
C:\Inetpub\imcorp_asp\addManufacturer.aspx:line 58
Any idea? All other chapters worked like charm.
--
Cheers
Ekhaat 3 1804
which language was that..Austrian,Norwegian,finnish or swedish!
The "Action needs an updatable query" error if i recall means you don't have
permission to write to the database file!
So go the the folder where the file exist or the file and make sure you have
the right access to write to the file!
GDLUCK
Patrick
"Ekhaat" wrote: Hi
I followed the Web Matrix guided tour and came to the "ASP.NET Pages with Data (Microsoft Access)" part.
There is really not much you can do wrong there, but for some reason, the INSERT part gives me an error. Here is the function that fails (appart from the exception handling everything is generated by the code wizard):
Function InsertManufacturer(ByVal manufacturerCode As String, ByVal name As String, ByVal address As String, ByVal webSite As String) As Integer Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\MatrixProjects.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )
Dim queryString As String = "INSERT INTO [Manufacturer] ([ManufacturerCode], [Name], [Address], [WebSite]) VALUES (@ManufacturerCode, @Name, @Address, @WebSite)" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection
Dim dbParam_manufacturerCode As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_manufacturerCode.ParameterName = "@ManufacturerCode" dbParam_manufacturerCode.Value = manufacturerCode dbParam_manufacturerCode.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_manufacturerCode) Dim dbParam_name As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_name.ParameterName = "@Name" dbParam_name.Value = name dbParam_name.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_name) Dim dbParam_address As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_address.ParameterName = "@Address" dbParam_address.Value = address dbParam_address.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_address) Dim dbParam_webSite As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_webSite.ParameterName = "@WebSite" dbParam_webSite.Value = webSite dbParam_webSite.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_webSite)
Dim rowsAffected As Integer = 0 dim ex as exception ' To see what error it is dbConnection.Open Try rowsAffected = dbCommand.ExecuteNonQuery Catch ex msgLabel.Text = "Database Error: <br>" & ex.source & "<br>" & ex.message & "<br>" & ex.stacktrace msgLabel.Visible = true Finally dbConnection.Close End Try
Return rowsAffected
End Function The ex.message returns (danish):
"Handlingen skal bruge en opdaterbar forespørgsel"
which means something to the effect:
"Action needs an updatable query"
The ex.stacktrace says:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at ASP.addManufacturer_aspx.InsertManufacturer(String manufacturerCode, String name, String address, String webSite) in C:\Inetpub\imcorp_asp\addManufacturer.aspx:line 58
Any idea? All other chapters worked like charm.
-- Cheers
Ekhaat
Ohhh...., You are the best, well, better than me anyway :-)
Thank you
"Patrick.O.Ige" wrote: which language was that..Austrian,Norwegian,finnish or swedish! The "Action needs an updatable query" error if i recall means you don't have permission to write to the database file! So go the the folder where the file exist or the file and make sure you have the right access to write to the file! GDLUCK Patrick "Ekhaat" wrote:
Hi
I followed the Web Matrix guided tour and came to the "ASP.NET Pages with Data (Microsoft Access)" part.
There is really not much you can do wrong there, but for some reason, the INSERT part gives me an error. Here is the function that fails (appart from the exception handling everything is generated by the code wizard):
Function InsertManufacturer(ByVal manufacturerCode As String, ByVal name As String, ByVal address As String, ByVal webSite As String) As Integer Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\MatrixProjects.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )
Dim queryString As String = "INSERT INTO [Manufacturer] ([ManufacturerCode], [Name], [Address], [WebSite]) VALUES (@ManufacturerCode, @Name, @Address, @WebSite)" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection
Dim dbParam_manufacturerCode As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_manufacturerCode.ParameterName = "@ManufacturerCode" dbParam_manufacturerCode.Value = manufacturerCode dbParam_manufacturerCode.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_manufacturerCode) Dim dbParam_name As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_name.ParameterName = "@Name" dbParam_name.Value = name dbParam_name.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_name) Dim dbParam_address As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_address.ParameterName = "@Address" dbParam_address.Value = address dbParam_address.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_address) Dim dbParam_webSite As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_webSite.ParameterName = "@WebSite" dbParam_webSite.Value = webSite dbParam_webSite.DbType = System.Data.DbType.String dbCommand.Parameters.Add(dbParam_webSite)
Dim rowsAffected As Integer = 0 dim ex as exception ' To see what error it is dbConnection.Open Try rowsAffected = dbCommand.ExecuteNonQuery Catch ex msgLabel.Text = "Database Error: <br>" & ex.source & "<br>" & ex.message & "<br>" & ex.stacktrace msgLabel.Visible = true Finally dbConnection.Close End Try
Return rowsAffected
End Function The ex.message returns (danish):
"Handlingen skal bruge en opdaterbar forespørgsel"
which means something to the effect:
"Action needs an updatable query"
The ex.stacktrace says:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at ASP.addManufacturer_aspx.InsertManufacturer(String manufacturerCode, String name, String address, String webSite) in C:\Inetpub\imcorp_asp\addManufacturer.aspx:line 58
Any idea? All other chapters worked like charm.
-- Cheers
Ekhaat
No worries Ekhaat...
By the way i speak Danish!!!!!!!!
Enjoy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Randell D. |
last post by:
Folks,
I use PHP to write my form data to MySQL.
I have a database with about ten tables. I'm trying to fill one table with
some dummy data (its a contact manager table holding names of...
|
by: Gigi.com |
last post by:
Hi All.
I need some help trying to pull prices from a price matrix. Here's an
example:
>>>> 1000 1500 2000 2500
-----------------------------------------
1000 ¦ 10.20 ...
|
by: raj |
last post by:
Hi,
I saw it mentioned that "int" is the fastest data-type for use in C
,that is data storage/retrieval would be the fastest if I use int among
the following 4 situations in a 32 bit machine with...
|
by: Bob Alston |
last post by:
I have a routine to copy data to new versions of my app via insert into
sql statements. Unfortunately, due to evolution of my app, sometimes
the new version has more restrictive editing than an...
|
by: nolanmadson |
last post by:
I'm creating a front-end for some Teradata user maintenance tables in
MS Access. I've started having problems in occasionally not being able
to insert or update records in these tables. I've been...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: Peterwkc |
last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back.
By the way, my problem is like this i the first program was...
|
by: robert |
last post by:
Often I want to extract some web table contents. Formats are
mostly static, simple text & numbers in it, other tags to be
stripped off. So a simple & fast approach would be ok.
What of the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |