We were using Oracle 11g with MSDAORA as a provider but since MSDAORA will be deprecated we have to move to a new provider for the connection string. We're also using Oracle Client 12c right now
Before we were using: Provider=MSDAORA.1;Password=;User ID=;Data Source=****11G.WORLD; Persist Security Info=True
Now we're trying to use: Provider=OraOLEDB.Oracle;OLEDB.NET=true;PLSQLRSet=true; Password=;User ID=*;Data Source=****11G.world;Persist Security Info=True
The problem is IIS crashes, and we got this exception, we have been trying to solve this issue for weeks and no luck yet:
Exception Details
SystemAccessViolationException Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.UnsafeNativeMethods.1CommandTextExecute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected,
Object& ppRowset)
at System.Data.01eDb.0IeDbCommand.ExecuteCommandTextForSingleResult(tagDBPAFtAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.01eDb.01eDbCommand.ExecuteReaderIntemal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.01eDb.0IeDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.Filllnternal(DataSet dataset, DataTable0 datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTableD dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at M.Planned_DataloadDataCurGrid() in D: Projects\ M\Planned_Data.aspx.vb:line 637
at M.Planned_Data.cmbProgram_SelectedIndexChanged(Object sender, EventArgs e) in DAProjectAM \Planned_Data.aspx.vb:line
484
at System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs
e)
at System.Web.ULWebControls.DropDownListRaisePostDataChangedEvent()
at System.Web.UI.WebControls.DropDownListSystem.Web.ULIPostBackDataHandler.RaisePostDataChangedEvento
at System.Web.ULPage.RaiseChangedEvents()
This is a simple minimum reproduction:
Public Sub LoadGrid()
Dim ocn As OleDbConnection = New OleDbConnection("Provider=OraOLEDB.Oracle;OLEDB.NET=true;PLSQLRSet=true; Password=*****;User ID=*****;Data Source=****11G.world;Persist Security Info=True")
Dim oda As New OleDbDataAdapter
Dim odataSet As New DataTable
Dim opm As OleDbParameter
Dim oCmd As New OleDbCommand
opm = New OleDbParameter("pi_language_code", OleDbType.Char)
opm.Value = "E"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_year_id", OleDbType.Integer)
opm.Value = "2020"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_month_id", OleDbType.Integer)
opm.Value = "2"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_program_id", OleDbType.Integer)
opm.Value = "4"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_location_id", OleDbType.Integer)
opm.Value = "2"
oCmd.Parameters.Add(opm)
Try
ocn.Open()
oCmd.Connection = ocn
oCmd.CommandType = CommandType.StoredProcedure
oCmd.CommandText = "***********"
oCmd.ExecuteNonQuery()
oda.SelectCommand = oCmd
odataSet.Clear()
oda.Fill(odataSet) 'This is where it crashes
Dim rowcount As Integer = odataSet.Rows.Count
dgCurrentYear.DataSource = odataSet
dgCurrentYear.DataBind()
If rowcount > 0 Then
dgCurrentYear.Visible = True
Else
dgCurrentYear.Visible = False
End If
Catch ex As OleDbException
' Display the error
Catch ex As Exception
' Display the error
Finally
' Clean up
If (Not ocn Is Nothing) AndAlso (Not ocn.State = ConnectionState.Closed) Then
ocn.Close()
End If
ocn = Nothing
opm = Nothing
End Try
End Sub
so we solved the problem by removing the line oCmd.ExecuteNonQuery()
Because I don't have to call ExecuteNonquery since the fill method of the DataAdapter is taking care of that.
Programming Practice: Using ExecuteNonQuery with SqlDataAdapter
Related
I am running a RESTful API service which gets data from a server as a JSON string. Around 20000 rows are being selected.
Dim js As New JavaScriptSerializer()
Dim prodlist As List(Of Product) = js.Deserialize(Of List(Of Product))(JSONreturn)
The 20000 rows are populated in the list prodlist. Checked the count and manually verified the list.
I need to insert these rows in a client machine. However, while inserting the rows, it freezes or stops after inserting around 600-700 rows. Below is the code I am using for inserting.
For Each item As Product In prodlist
Dim SPName As String = "someSPname"
With connectionstring
.Clear()
.Parameters("#itemnumber", SqlDbType.VarChar, ParameterDirection.Input, , item.itemnumber
.Parameters("#itemtype", SqlDbType.VarChar, ParameterDirection.Input, , item.itemtype)
.Parameters("#DESCRIPTION", SqlDbType.VarChar, ParameterDirection.Input, , item.DESCRIPTION)
.Execute(SPName)
End With
Next
No error is thrown. It just freezes after inserting roughly 600-700 rows everytime.
Bulk insert is not an option. How do I resolve this?
UPDATE : Adding connection class. Pretty sure there is no issue with this :
Public Class ConnectionClass
Public ReadOnly Property ConnectionString() As String
Get
Return GetConfiguration()
End Get
End Property
Public Sub Parameters(ByVal param_name As String, ByVal type As SqlDbType, ByVal direction As ParameterDirection, Optional param_size As Int32 = Nothing, Optional param_value As Object = Nothing)
Dim sqlParam As SqlParameter = Nothing
Try
sqlParam = New SqlParameter(param_name, type)
sqlParam.Size = param_size
sqlParam.Direction = direction
sqlParam.Value = param_value
Lstparam.Add(sqlParam)
Finally
If sqlParam IsNot Nothing Then
sqlParam = Nothing
End If
End Try
End Sub
Public Sub Execute(ByVal strSpName As String, Optional ByVal Type As CommandType = CommandType.StoredProcedure)
Try
sqlcmd = New SqlCommand()
sqlcmd.Connection = connection
''Setting the timeout to 50 mins as setup in the previous application
sqlcmd.CommandTimeout = 3000
If transaction IsNot Nothing Then
sqlcmd.Transaction = transaction
End If
sqlcmd.CommandType = Type
sqlcmd.CommandText = strSpName
For Each argument As SqlParameter In Lstparam
sqlcmd.Parameters.Add(argument)
Next
For introw As Integer = 0 To sqlcmd.Parameters.Count - 1
If sqlcmd.Parameters.Item(introw).ParameterName.Contains("Parameter") Then
sqlcmd.Parameters.Item(introw).ParameterName = String.Empty
End If
Next
sqlcmd.ExecuteNonQuery()
Catch ex As Exception
Throw
End Try
End Sub
Public Sub Clear()
ClearParameters()
Lstparam.Clear()
End Sub
Public Sub ClearParameters()
If Not sqlcmd Is Nothing Then
Do Until sqlcmd.Parameters.Count = 0
sqlcmd.Parameters.Clear()
Loop
End If
End Sub
Public Function GetConfiguration() As String
Dim sbConnectionString As New StringBuilder
With sbConnectionString
.Append("Data Source=")
.Append(ServerName)
.Append(";")
.Append("Initial Catalog =")
.Append(DatabaseName)
.Append(";")
.Append("User ID =")
.Append(UserName)
.Append(";")
.Append("Password =")
.Append(UserPassword)
End With
Return sbConnectionString.ToString()
End Function
Public Function CreateClientConnection() As SqlConnection
Dim connectionString As String
Try
connectionString = GetConfiguration()
Dim substrings() As String = connectionString.ToUpper.Split(";")
Dim substrings1() As String = connection.ConnectionString.ToUpper.Split(";")
If Not (connection.State = ConnectionState.Open) Then
connection.ConnectionString = connectionString
connection.Open()
ElseIf Not (Trim(substrings(0)) = Trim(substrings1(0))) Then
If connection IsNot Nothing Then
connection.Dispose()
End If
connection.ConnectionString = connectionString
connection.Open()
End If
Return connection
Catch ex As Exception
If connection IsNot Nothing Then
connection.Dispose()
End If
Throw ex
End Try
End Function
End Class
I get this err page:
Server Error in '/EMS/customerreportingnet' Application.
Operation is not valid due to the current state of the object.
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.InvalidOperationException: Operation is not valid due to the current state of the object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +4198079
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +60
System.Web.HttpRequest.FillInFormCollection() +189
[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +11196408
System.Web.HttpRequest.get_Form() +119
System.Web.TraceContext.InitRequest() +1188
System.Web.TraceContext.VerifyStart() +133 System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +11307449
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +452
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491
...when I click the button which fires this code:
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim upd8DML As String = "UPDATE CustomerCategoryLog SET Category = 'Exploding' WHERE Unit = #Unit And MemberNo = #MemberNo AND Custno = #CustNo"
Dim coName As String
Dim argVals(2) As String
Dim _Unit As String
Dim _MemberNo As String
Dim _CustNo As String
Dim curIndexVal As String
For Each cntrl As Control In Me.Controls
If TypeOf cntrl Is CheckBox Then
If DirectCast(cntrl, CheckBox).Checked = True Then
curIndexVal = DirectCast(cntrl, CheckBox).ID
coName = GetLabelTextForID(curIndexVal)
argVals = GetArgValsForCompanyName(coName)
_Unit = argVals(0)
_MemberNo = argVals(1)
_CustNo = argVals(2)
Using conn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")), _
cmd As New SqlCommand(upd8DML, conn)
cmd.Parameters.Add("#Unit", SqlDbType.VarChar, 50).Value = _Unit
cmd.Parameters.Add("#MemberNo", SqlDbType.VarChar, 50).Value = _MemberNo
cmd.Parameters.Add("#CustNo", SqlDbType.VarChar, 50).Value = _CustNo
conn.Open
cmd.ExecuteScalar()
End Using
End If
End If
Next
End Sub
My guess is that this is because the literally thousands of label/checkbox pairs of controls on the form are too much to handle (no pun intended). If this reckoning is right, what is the limit of controls that the page will host without whin[g]ing?
Is there a workaround where I can deal with thousands of label/checkbox pairs?
Or is it the number of update statements that are causing the problem?
The err msg seems to indicate too many controls to deal with...
So I have an application that is writing to an oracle database, then another that is reading the data from the same database.
When I get to the line Dim msgTime As TimeSpan = reader.GetTimeSpan(2), I get an exception (see below).
The Oracle Documentation says that INTERVAL DAY TO SECOND (which is how I'm storing the data in the DB) can be converted to timespan (see here)
Does anyone know what causes this exception, and how to avoid it?
Thanks.
Exception:
Oracle.DataAccess.Types.OracleTypeException
Provider type could not be represented as a .NET type
at Oracle.DataAccess.Types.TimeSpanConv.GetTimeSpan(OpoITLValCtx* pValCtx, OracleDbType oraType)
at Oracle.DataAccess.Client.OracleDataReader.GetTimeSpan(Int32 i)
at MyProgram.pollDatabase(Object sender, DoWorkEventArgs e)
Write to DB code:
Dim oCommand As New OracleCommand("INSERT INTO LOGTABLE(PK, MID,MDATE,MTIME,STATUS,SEVERITY,ORIGQ,MESSAGE) VALUES (:pk, :msgid, :msgdate, :msgtime, :status, :severity, :message)")
oCommand.Parameters.Add("pk", OracleDbType.Varchar2, Guid.NewGuid().ToString().Substring(0, 12), ParameterDirection.Input)
oCommand.Parameters.Add("msgid", OracleDbType.Varchar2, message.MessageID, ParameterDirection.Input)
oCommand.Parameters.Add("msgdate", OracleDbType.Date, putDateSQL, ParameterDirection.Input)
oCommand.Parameters.Add("msgtime", OracleDbType.IntervalDS, putTimeSQL, ParameterDirection.Input)
oCommand.Parameters.Add("status", OracleDbType.Varchar2, "NEW", ParameterDirection.Input)
oCommand.Parameters.Add("severity", OracleDbType.Varchar2, messageSeverity, ParameterDirection.Input)
oCommand.Parameters.Add("message", OracleDbType.Clob, clob, ParameterDirection.Input)
Read from DB Code:
Dim conn As OracleConnection = New OracleConnection(oradb)
Dim oCommand As New OracleCommand("SELECT MID,MDATE,MTIME,STATUS,SEVERITY, ORIGQ, MESSAGE FROM LOGTABLE")
oCommand.CommandType = CommandType.Text
oCommand.Connection = conn
oCommand.Connection.Open()
Dim reader As Oracle.DataAccess.Client.OracleDataReader = oCommand.ExecuteReader()
If reader.HasRows Then
While reader.Read()
Try
Dim messageID As String = reader.GetString(0)
Dim msgDate As Date = reader.GetDateTime(1)
If Not reader.IsDBNull(2) Then
Dim msgTime As TimeSpan = reader.GetTimeSpan(2)
End If
Dim msgStatus As String = reader.GetString(3)
Dim msgSeverity As String = reader.GetString(4)
Dim msgOrigin As String = reader.GetString(5)
Dim msgContent As String = reader.GetString(6)
Catch ex As Exception
Console.Out.WriteLineAsync(ex.Message)
End Try
End While
End If
I needed to use Dim msgTimeInterval As Oracle.DataAccess.Types.OracleIntervalDS = reader.GetOracleIntervalDS(2) instead of Dim msgTime As TimeSpan = reader.GetTimeSpan(2)
Good day, I am a newbie in .net programming and also IIS web deployment configuration.
Currently, I have an asp.net application that runs using Framework 4.5 on IIS. For the first month of having the application deployed on the server, it was running fine and smoothly. However, recently the application had issues whereby the login page would actually load but when the users key in their credentials, the page loading timer would show and it disappears, leaving the user stranded, unable to login.
In addition, the server had undergone security procedures as stated below:
Windows Hardening (Using Windows Server 2012)
SQL Server Hardening (SQL Server 2012) and port was changed to 8001
Also, the architecture of the application is that:
The Application is deployed in AMLWEB server
The SQL Server Database is in AMLDB server
So, the connection actually goes across server and the login authentication is actually authenticated against Active Directory.
The screenshot as attached:
Unhandled exception screenshot
When checked on the event viewer, the below warning was seen that may suggest to be contributing to the issue:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/18/2015 5:27:15 PM
Event time (UTC): 1/18/2015 9:27:15 AM
Event ID: 2ac169fff7284e86b7b0844e5d9ccab1
Event sequence: 4
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT/AML-1-130660468323976167
Trust level: Full
Application Virtual Path: /AML
Application Path: D:\AML\
Machine name: AMLWEB
Process information:
Process ID: 6756
Process name: w3wp.exe
Account name: IIS APPPOOL\.NET v4.5
Exception information:
Exception type: InvalidOperationException
Exception message: The ConnectionString property has not been initialized.
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at DBManager.DBManager.OpenConnection(String DBStrConn, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 50
at DBManager.DBManager.ExecuteSQLQuery_ReturnDS(String& ReturnErrorMsg, String SqlString, String DBConnString, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 190
at SQLAdminQueryManager.AdminQueryManager.AdminQueryManager_Staff_Login.Staff_Login_Retreive(cor_staff AppEntity, String DbSQLConnString, String DbType, String& ReturnErrorMsg, Object& ReturnObjDataset, String AccessType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\SQLAdminQueryManager\AdminQueryManager.vb:line 65
at Login_page_LDAP_Code.LoginButton_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Request information:
Request URL: https://amlweb/AML/Login_page.aspx
Request path: /AML/Login_page.aspx
User host address: 10.1.67.61
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\.NET v4.5
Thread information:
Thread ID: 10
Thread account name: IIS APPPOOL\.NET v4.5
Is impersonating: False
Stack trace: at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at DBManager.DBManager.OpenConnection(String DBStrConn, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 50
at DBManager.DBManager.ExecuteSQLQuery_ReturnDS(String& ReturnErrorMsg, String SqlString, String DBConnString, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 190
at SQLAdminQueryManager.AdminQueryManager.AdminQueryManager_Staff_Login.Staff_Login_Retreive(cor_staff AppEntity, String DbSQLConnString, String DbType, String& ReturnErrorMsg, Object& ReturnObjDataset, String AccessType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\SQLAdminQueryManager\AdminQueryManager.vb:line 65
at Login_page_LDAP_Code.LoginButton_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:
However, the connection string was indeed had been set up properly as below:
Web.config
<connectionStrings>
<add name="AMLDBConnectionString" connectionString="Data Source=AMLDB01, 8001;Initial Catalog=AML_DB;integrated security=true; uid=sa; pwd=p#ssw0rd"/>
</connectionStrings>
And it was set up as a global variable as so:
GlobalSQLConnString = ConfigurationManager.ConnectionStrings("AMLDBConnectionString").ToString
GlobalDBType As Int16 = 1
The line which actually executed to connect to the DB:
blnReturnValue = objSqlQuery.Staff_Login_Retreive(objBE, GlobalSQLConnString, GlobalDBType, strErrorMsgReturn, returnDS, "S")
The method invoked:
Public Function Staff_Login_Retreive(ByVal AppEntity As BusinessEntities.cor_staff, _
ByVal DbSQLConnString As String, ByVal DbType As String, _
ByRef ReturnErrorMsg As String, ByRef ReturnObjDataset As Object, _
Optional ByVal AccessType As String = "S") As Boolean
With AppEntity
SQlQuery = "SELECT * "
SQlQuery += " FROM cor_staff "
SQlQuery += " WHERE cor_staff.cor_userid =N'" & AppEntity.cor_userid & "'"
End With
'
If AccessType.ToUpper = "R" Then
ReturnObjDataset = ExecuteSQLQuery_ReturnIDR(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
Else
ReturnObjDataset = ExecuteSQLQuery_ReturnDS(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
End If
'
If ReturnErrorMsg.Trim.Length = 0 Then
Return True
Else
Return False
End If
'
End Function
Edited
Since the above code would actually run through and would actually be invoked on this line:
ReturnObjDataset = ExecuteSQLQuery_ReturnDS(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
The connection would only be opened here:
Public Function ExecuteSQLQuery_ReturnDS(ByRef ReturnErrorMsg As String, ByVal SqlString As String, ByVal DBConnString As String, ByVal DBType As Int16) As DataSet
ReturnErrorMsg = ""
Dim DS As New DataSet
'
If DBType = 1 Then
Try
OpenConnection(DBConnString, DBType)
Dim sqlCmd As New SqlCommand(SqlString, sqlConn)
sqlCmd.CommandTimeout = 0
Dim sqlDaAdp As New SqlDataAdapter(sqlCmd)
sqlDaAdp.Fill(DS)
sqlCmd = Nothing
sqlDaAdp = Nothing
CloseConnection(DBType)
Return DS
Catch ex As SqlException
If ex.Number = 18456 Or ex.Number = 4060 Then
ReturnErrorMsg = "Database Connection Error >> Error No : " & ex.Number
Else
ReturnErrorMsg = "SQL Statement Error >> Error No : " & ex.Number
End If
CloseConnection(DBType)
Return Nothing
End Try
ElseIf DBType = 3 Then
Try
OpenConnection(DBConnString, DBType)
Dim oledbCmd As New OleDbCommand(SqlString, oleDbconn)
Dim oledbDaAdp As New OleDbDataAdapter(oledbCmd)
oledbDaAdp.Fill(DS)
oledbDaAdp = Nothing
oledbDaAdp = Nothing
CloseConnection(DBType)
Return DS
Catch ex As OleDbException
If ex.ErrorCode = -2147217887 Then
ReturnErrorMsg = "Database Connection Error >> Error Code : " & ex.ErrorCode
Else
ReturnErrorMsg = "SQL Statement Error >> Error Code : " & ex.ErrorCode
End If
CloseConnection(DBType)
Return Nothing
End Try
End If
'
Return Nothing
'
End Function
Open connection method:
Public Sub OpenConnection(ByVal DBStrConn As String, ByVal DBType As Int16)
Try
If DBType = 1 Then
sqlConn = New SqlConnection(DBStrConn)
If sqlConn.State = ConnectionState.Closed Then
sqlConn.Open()
Else
sqlConn.Close()
sqlConn.Open()
End If
ElseIf DBType = 3 Then
oleDbconn = New OleDbConnection(DBStrConn)
If oleDbconn.State = ConnectionState.Closed Then
oleDbconn.Open()
Else
oleDbconn.Close()
oleDbconn.Open()
End If
End If
'
Catch ex As Exception
Throw
End Try
End Sub
End of edited part
Does anyone have any idea why does such exception would occur?
So far, I've done the following to actually try to debug this issue:
Restart IIS
Restart Application Pool
Recycle Application Pool (every 12 hours, 8 a.m. and 8 p.m. specifically)
Restart SQL Server Service
None of the above worked. But when I actually tried accessing the application from a specific floor in which is the Security Team floor, the application actually starts functioning as usual, and others could actually access the application as well.
Please help, I'm totally going out of my mind about this issue.
Does it have anything to do with my deployment method, iis configuration or programming, I'm willing to listen to suggestions.
Thanks for your time.
I become an errorcode 1001, an SAP Remote error?
I've googled alot but didn't find anything.
Maybe someone knows whats the Problem here.
Im using SAP 720.
System.Runtime.InteropServices.COMException (0x000003E9): SAP Remote
Function Call bei
Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack) bei
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) ...
Here is my code:
Public FunctionCtrl As Object
Function login_Call()
Try
Dim conn As Object
FunctionCtrl = CreateObject("SAP.Functions")
conn = FunctionCtrl.Connection
conn.System = XXX
conn.ApplicationServer = XXX
conn.SystemNumber = XXX
conn.Client = "XXX"
conn.user = XXX
conn.Password = XXX
conn.Language = XXX
'needed for frontend dialog
conn.RfcWithDialog = True
'log on with logon dialog
If Not conn.Logon(0, 1) Then
Dim WsShell
Dim intText As Integer
WsShell = CreateObject("WScript.Shell")
intText = WsShell.Popup("Logon not succesful." & vbCrLf & _
"will be closed automatically in one minute...", 60)
'conn = Nothing
Anmeldung_Call = False
Exit Function
End If
Anmeldung_Call = True
Catch ex As Exception
Anmeldung_Call = False
End Try
Me.Text = DateTime.Now.ToString()
End Function
Sub Open_IW73()
Dim BdcTable As Object
Dim RfcCallTransaction As Object
Dim Messages As Object
Dim count As Integer
'call transaction IW73
RfcCallTransaction = FunctionCtrl.Add("RFC_CALL_TRANSACTION")
RfcCallTransaction.Exports("TRANCODE") = "IW73"
RfcCallTransaction.Exports("UPDMODE") = "S"
BdcTable = RfcCallTransaction.Tables("BDCTABLE").....
The Error comes in this line: "RfcCallTransaction = FunctionCtrl.Add("RFC_CALL_TRANSACTION")
"
Thank you
I've had the same error. People suggested different fixes like using SAP.functions.Unicode.
What did it for me was simply changing to "RFC_CALL_TRANSACTION_USING". I'm not sure of the exact difference between these commands, so be careful with that. So far it has been working for me though.