473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

ExecuteNonQuery Update Not Working

Hello -

I am currently working on an asp.net application that needs to be able
to update an access table using ExecuteNonQuery method. I have all the
code setup, it runs, there are no errors thrown, yet...nothing is being
updated. The only thing I can see is the ExecuteNonQuery returns 0
when the update is run. Can anyone help please?

Here is some of the code:

Dim strUpdateServers As String
Dim strUpdateServerDataCenter As String
Dim sqlConn As New OleDbConnection
Dim strConnection As String
Dim strdebug As String

strUpdateServers = "Update [Servers] Set [ServerType] =
@ServerType, " & _
"[Tier] = @ServerFunction, [Platform] = @Platform, " & _
"[NumAffectedUsers] = @NumUsersAffected, [NumPrintQueues] =
@NumPrintQueues, " & _
"[NumUsersWithAccounts] = @NumUsersWithAccounts,
[NumDesktops] = @NumDeskTops, " & _
"[OsVer] = @OsVer, [ServicePack] = @ServicePack, " & _
"[HotFixes] = @HotFixes, [StorageConfig] = @StorageConfig, "
& _
"[SerialNumber] = @SerialNumber, [FormFactor] = @FormFactor,
" & _
"[RackTower] = @RackTower, [Make] = @Make, " & _
"[Model] = @Model, [ProcessorType] = @ProcessorType, " & _
"[ProcessorQty] = @ProcessorQty, [ProcessorSpeed] =
@ProcessorSpeed, " & _
"[PhysMemSize] = @PhysMemSize, [PhysMemType] = @PhysMemType,
" & _
"[NetEISS] = @NetEISS, [TagNumber] = @TagNumber, " & _
"[NetBIOSSysName] = @NetBIOSSysName, [SNMPPubCommunity] =
@PubCommunity, " & _
"[SNMPPrivCommunity] = @PrivCommunity WHERE [ServerName] =
@ServerName"

'Get connection string from Web.Config
strConnection =
ConfigurationSettings.AppSettings("ConnectionStrin g")
sqlConn = New OleDbConnection(strConnection)
sqlConn.Open()

Dim myCommand As OleDbCommand = New
OleDbCommand(strUpdateServers, sqlConn)
myCommand.CommandType = CommandType.Text

Dim parmServerType As OleDbParameter = _
New OleDbParameter("@ServerType", OleDbType.VarWChar)
parmServerType.Value =
(lstServerType.SelectedItem.Value.ToString)

myCommand.Parameters.Add(parmServerType)

Dim parmServerFunction As OleDbParameter = _
New OleDbParameter("@ServerFunction", OleDbType.VarWChar)
parmServerFunction.Value =
(lstServerFunction.SelectedValue.ToString)
myCommand.Parameters.Add(parmServerFunction)

Dim parmPlatform As OleDbParameter = _
New OleDbParameter("@Platform", OleDbType.VarWChar)
parmPlatform.Value = (lstPlatform.SelectedValue.ToString)
myCommand.Parameters.Add(parmPlatform)
.... rest of the parameters setup code ...
Try
Dim i as integer
i = myCommand.ExecuteNonQuery() 'Execute the UPDATE servers query
Response.Write i.ToString ' used to see result of update.
Catch ex As Exception
Response.Write("Error updating Servers Table")
Response.Write(ex.Message)
End Try

Nov 19 '05 #1
0 3014

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vince Varallo | last post by:
Hello All, I am using the command.ExecuteNonQuery() method to execute an update statement. I then check the return value to see how many records were affected by the update. This used to work...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
1
by: Francis | last post by:
Hello, My question is: is it better to use DataSets than the simple ExecuteNonQuery() methods. I thought the DataSets would be a better structured way of programming, but it seems to result in...
3
by: Darryn Ross | last post by:
Hi, I am having a problem updating a database table in an application of mine. The application is thrown when i fire the following command... Adapter.UpdateCommand.ExecuteNonQuery() ; The...
1
by: DaveS | last post by:
Hi! I originally posted this in the dotnet.framework.adonet, but I'm not sure that was the right place. Anyway... I am exeuting an INSERT query from within a public function. Is there any...
2
by: jdb | last post by:
Hi, I am adding a record to the database using an ExecuteNonQuery, which adds without problem. Now after the record is added I run a method passing in some info as well as the curretnly opened...
6
by: ssailor | last post by:
Hi, everybody, I am rusty with VB. In the following code, ------------------------------------------------------ Dim dbCmd1 As OleDbCommand = New OleDbCommand("UPDATE tblLogin SET Password =...
0
by: =?Utf-8?B?Sm9uIEphY29icw==?= | last post by:
When I update a small table, no problem. When I Update a single field on a single row in a large table, OracleCommand.ExecuteNonQuery hangs and never comes back. Note, the where clause specifies a...
2
by: Tony Johansson | last post by:
Hello! If you do an update in the database you will use ExecuteNonQuery but the database update will work just as good if you instead use ExecuteReader or executeScalar. So my question is how...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.