C# :: ODBC - ExecuteNonQuery Gives Timeout - > Where To Increase This?
Dec 10, 2010
I add C# group too in this, because this is not VB problem but ExecuteNonQuery gives timeout. how to increase the time-out?Exact errormessage: ERROR [HYT00] [Microsoft][ODBC SQL Server Driver]Timeout expiredwe do have cms system and in that CMS I have created a IFRAME which calls this ASPX +VB code, which is in different physicall folder and it has managed Pipeline Classic. When I run this in Old application it works fine. But I copied the pages to the news server and created new application pool/website Call OldASPPAGES I get ODBC timeout on 'ExecuteNonQuery()' function below. Sometimes I works but 9 of the 10 cases I gettimeout. I checked the records and there are 247 records. But below you see there are 2 sql statements composed per Each loop. (update and insert)... 2 x 247 records = approx. 500 records.
But since the sql statement is concantenated so 1 call of ExecuteNonQuery, executue does do 500 SQL Statements.... I know this is GARBAGE, unacceptable.... But I inherited so for the moment I can't rewrite that.To the point:Below are the original statemenst: I have just added : conn.ConnectionTimeout = 240As you can see I've added 240 seconds, but I still get timeouts after approx. 30 secs... so this is not the right place.... question:- Why does this statement work in old ASP environment (without problem) and not in this environement in an IFRAME.
sql = sql & ", a30b_errorcode=" & data_30bis.errorCode
sql = sql & ", a30b_inputcompanyidvalid=" & Abs(CInt(data_30bis.inputCompanyIdValid))
sql = sql & ", a30b_inputnossvalid=" & Abs(CInt(data_30bis.inputNossValid))
[code].....
View 3 Replies
ADVERTISEMENT
Jun 4, 2009
I have to increase timeout period.Following is my code.
Private Function GetConnectionInstance() As SqlConnection
Dim objConn As SqlConnection
Dim strConnection As String
strConnection = ConfigurationSettings.AppSettings("conn")
[code]....
What code i have to add in above to increase timeout period.
View 3 Replies
Feb 16, 2009
I'm trying to code an 'increase' button to prompt a user to input a rate by which to increase select prices in an array.It should request the increased rate, then request a number from one to five, representing which price in the array to increase.Then, if 'increase' button is selected again and another number from one to five is chosen, then that element should be increased.It's working, but all the numbers in the array are changed. And, when I hit the increase button again, the array is repopulated below the first price increases instead of only replacing the designated price.
'declare 5 element array of prices
Dim prices() As Double = {12.2, 8.5, 12, 50, 2.4}
Dim rateIncrease As Decimal
Dim isConverted As Boolean
[code].....
View 1 Replies
May 3, 2011
I'm not sure if this is a VB.NET error or SQL Server. But I get the above error with following stack trace:
[SqlException (0x80131904): Timeout
expired. The timeout period elapsed
prior to completion of the operation
or the server is not responding.]
System.Data.SqlClient.SqlConnection.OnError(SqlException
[code]....
View 3 Replies
Oct 24, 2011
I have a small vb.net application that fires a crystal report through crystal viewer.
The report uses an ODBC connection provided by 32-bit software accounts package, which is installed in the ODBC 32-bit This all works fine on 32-bit XP and 32-bit Win7 with no problems, When run on a win7 64-bit machine the application launches ok, but when it comes to running the report, it prompts for a database logon box for the odbc connection.
When the report is run seperate on its own, on the exact same pc through crystal reports desginer it runs fine, Its almost like the application is not picking the 32-bit ODBC set up is it the case that the connection needs to be coded rather than using the report connection,
View 3 Replies
Feb 25, 2010
I have added a Split container onto my Form and within bottom Panel I have added a list box.How can I increase the size of the list box as I increase the size of the panel?
View 3 Replies
Nov 23, 2006
i am new to vb .net i just want to ask why is it i don't see the odbc data adapter in the toolbox pane? i just have (under data) pointer, dataset, datagridview, bindingsource, and binding navigator.
View 3 Replies
Oct 16, 2010
I've just upgraded a project to .net 4.0, I'm getting an odd error using ExecuteNonQuery: Errors: {"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration infor
Dim xServer As Server = New Server(SQLServer)
Dim db As New Database(xServer, Database)
db = xServer.Databases(Database)
Dim xUser As New User(db, LoginName)
xUser.UserType = UserType.SqlLogin
[Code]...
View 3 Replies
Apr 15, 2012
I have a program where a user can update their Password by Entering their old password in a textbox, and entering their new password in a separate textbox.
An update query then updates the database with the new password.
CODE:
However, everytime the code gets to cmd.ExecuteNonQuery(), it throws up an error saying that there is a syntax error in the Update query. However, If I use this query in Microsoft Access, it works fine so the Update query itself is written correctly. What could be wrong?
Note: I am using an UPDATE query in another piece of code within the same Sub routine and it works there. Its something about this query.
Note Again: If I change the Update query to UPDATE Users SET EMAIL = '" & tbPassword.Text & "' WHERE userID = " & Row.Item(0)" it works. Something about Password that throws that error.
View 3 Replies
Sep 10, 2010
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
[code]....
View 4 Replies
Nov 30, 2009
Dim cmd As New SqlCommand("insert into fiche values('" & Me.TextBox1.Text & "')", connex)[code]...
View 2 Replies
Jun 9, 2011
Is there any way that i can be able to get the ExecutenonQuery to Execute faster. Am using it to run mysql queries that have joins from diffrent tables. As I have come to notice, the user has to wait a while before the statement ExecutenonQuery can be completely executed.. is there any way that I can get it to execute faster?
View 2 Replies
Oct 8, 2009
I'm trying to execute a SQL command, but I just can't find out why this is not working.This is how I defined the "execute" function in my class named "clsSQL":
[Code]...
View 6 Replies
Oct 22, 2009
I have the following query:
SELECT Inventory.Inventory_Id, Inventory.Inventory_description, Inventory.Inventory_stock_count, nz((SELECT Sum(Order.item_qty) AS SumOfitem_qty
FROM [Order]
WHERE Order.From_date<=Date() AND (Order.To_date)>=Date()
AND Order.Item_ID='I' & Inventory.Inventory_Id),0) AS CurrentlyOut, [Inventory_stock_count]-Nz((SELECT Sum(Order.item_qty) AS SumOfitem_qty
[Code]...
View 11 Replies
Nov 19, 2011
can i do ( ExecuteNonQuery within the loop of a datareader ) in vb.net please help me with example
View 3 Replies
May 25, 2010
I have this generic routine that I wrote that takes a list of sql strings and executes them against the database. Is there any way I can make this work faster? Typically it'll see maybe 200 inserts or deletes or updates at a time. Sometimes there is a mixture of updates, inserts and deletes. Would it be a good idea to separate the queries by type (i.e. group inserts together, then updates and then deletes)?I am running this against an ms access database and using vb.net 2005.
Public Function ExecuteNonQuery(ByVal sql As List(Of String), ByVal dbConnection as String) As Integer
If sql Is Nothing OrElse sql.Count = 0 Then Return 0
[code].....
View 1 Replies
Aug 29, 2011
In order to check if specific user is db_owner, i excute the following query:
"select is_rolemember('db_owner', '" & p_userName & "')"
using the SqlCommand ExecuteNonQuery method.How do I get the query result?
Here is my code:
Dim com As SqlCommand = New SqlCommand(sql, m_connection)
com.ExecuteNonQuery()
[code].....
View 3 Replies
Mar 11, 2010
i want to delete data from database,but i can't. i think it's because the executeNonQuery is being converted to string..here is my code :
kongkon = New SqlCommand("DELETE FROM [User] where User_ID= ' " + lblssearch.Text + " ' OR [First Name] = ' " + lblssearch.Text + "' ", con)
ra = CStr(kongkon.ExecuteNonQuery) ---> i think this is the problem
[code].....
View 1 Replies
Oct 12, 2009
I'm trying to execute a SQL command, but I just can't find out why this is not working. This is how I defined the "execute" function in my class named "clsSQL":
[Code]...
Probably, I just need another pair of eyes, 'cause I can't see what am I doing wrong Could this be related to the database and not to my code?
View 9 Replies
Oct 15, 2009
Everything I read says calling an SQL Server stored procedure (SP) via ExecuteNonQuery .ExecuteNonQuery(cmd) should return the number of rows affected. When I run my code it successfully inserts a new record but it returns -1. The SP itself is coded to return (0) if successful else return (-99). It is these values that I want to test after execution. I have tried to add a return value parameter to the DBCommand but this causes an error on that parameter: Quote:
[Code]...
View 2 Replies
May 28, 2010
UPDATE: I've modified the code to drop the indexes before the inserting, but it makes not difference.I've been asked to resolve an issue with a .Net/SqlServerCe application. Specifically, after repeated inserts against the db, performance becomes increasingly degraded. In one instance at ~200 rows, in another at ~1000 rows. In the latter case the code being used looks like this:
Dim cm1 As System.Data.SqlServerCe.SqlCeCommand = cn1.CreateCommand
cm1.CommandText = "INSERT INTO Table1 Values(?,?,?,?,?,?,?,?,?,?,?,?,?)"
For j = 0 To ds.Tables(0).Rows.Count - 1 'this is 3110
[code]....
The specifics aren't super important (like what 'tbl' is, etc) but rather whether or not this code should be expected to handle this number of inserts, or if the crawl I'm witnessing is to be expected.
View 2 Replies
Mar 17, 2011
when i use TOAD to update a table all works just fine when using this query:
Update CSR.CSR_EAI_SOURCE ces
Set (STATUS_CODE, COMPLETE_DATE, DATA) =
(SELECT 'ERROR', '', REPLACE(REPLACE(c.Data, '...', ' '), ''','''')
[code]....
It stays on the ra = OracleCommand.ExecuteNonQuery() continuously until i get the error The CLR has been unable to transition from COM context 0x3327fa8 to COM context 0x3328118 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.What could i do in order to get this working within VB.net since it works just fine in TOAD when running that same query?
View 2 Replies
Jun 2, 2011
I am just inserting a record in sqlserver database using stored procedure. In this code Binddata() is the method where i have binbed the gridview with records. here is the code:
[Code]...
View 1 Replies
Apr 23, 2012
I'm trying to update a record in MS Access database with the code below. But it says 'Syntax error in UPDATE statement and highlights cmd.ExecuteNonQuery()'.
[Code]...
View 5 Replies
Jun 6, 2011
With DbCommand I'm trying execute this SQL statement[code]...
But when I run each command from strCommand standalone then everything works fine.
I'm using VS 2010 Professional and SQL Server 2008 R2 Express.
View 2 Replies
Jul 26, 2010
I have a database which contains 60K null or blank records. These records contain several fields, all blank or null. I am using the following code, which I know works if there is text in the field, but if it is null or blank, I get negative results.
Dim
rv As
Integer
[code]....
how to check for null in an executenon query command?
View 15 Replies
Apr 16, 2009
I'm new to ASP.Net and I'm having an error while trying to add record to my database. Any help? After executing the code, I'm having the message "Error in INSERT INTO statement" and the execution stops at cmd.executenonquery().[code]
View 2 Replies
Jan 27, 2012
When i am try to execute following code it gives "ExecuteNonQuery: Connection property has not been initialized" error,
Try
Dim cmd As New OleDbCommand
Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\MILIND\Structure\Reports_DB.mdb;")
Mycn.Open()
[code].....
View 2 Replies
Jun 6, 2011
Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
[code].....
View 4 Replies
Apr 3, 2009
What value will be returned from below execution with select, insert, update, delete?
Dim L_EXECUTED_NO1 As Integer = command.ExecuteNonQuery()
Dim L_EXECUTED_NO2 As Integer command.ExecuteReader()
Dim L_EXECUTED_NO2 As Integer = command.ExecuteScalar()
For example, I tried "Dim L_EXECUTED_NO1 As Integer = command.ExecuteNonQuery()" with Update SQL statement and that returned "-1". But it returned 1 for Delete SQL statement.
If Query_SQL("EXEC SP_ATT_CLOCK_INOUT_UPDATE '" & L_TODAY_DT & "', '" & L_EMP_ID & "', '" & L_START_TM & "', '" ) = True Then
MsgBox("Successfully saved!", MsgBoxStyle.Information)
End If
Function Query_SQL(ByVal SQL_Query) As Boolean
[Code] ......
View 5 Replies