Click here to Skip to main content
15,909,091 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: DropDownlist Load Pin
Steve Echols23-Sep-09 18:04
Steve Echols23-Sep-09 18:04 
QuestionASP.NET with AD Pin
Socheat.Net23-Sep-09 17:02
Socheat.Net23-Sep-09 17:02 
AnswerRe: ASP.NET with AD Pin
Abhijit Jana23-Sep-09 17:15
professionalAbhijit Jana23-Sep-09 17:15 
GeneralRe: ASP.NET with AD Pin
Socheat.Net23-Sep-09 17:53
Socheat.Net23-Sep-09 17:53 
AnswerRe: ASP.NET with AD Pin
Arun Jacob23-Sep-09 18:46
Arun Jacob23-Sep-09 18:46 
QuestionAPS.NET Pin
mamix6523-Sep-09 13:24
mamix6523-Sep-09 13:24 
AnswerRe: APS.NET Pin
Not Active23-Sep-09 13:36
mentorNot Active23-Sep-09 13:36 
GeneralRe: APS.NET Pin
N a v a n e e t h23-Sep-09 15:29
N a v a n e e t h23-Sep-09 15:29 
GeneralRe: APS.NET Pin
Christian Graus23-Sep-09 17:14
protectorChristian Graus23-Sep-09 17:14 
GeneralRe: APS.NET Pin
Not Active24-Sep-09 1:02
mentorNot Active24-Sep-09 1:02 
AnswerRe: APS.NET Pin
Christian Graus23-Sep-09 15:28
protectorChristian Graus23-Sep-09 15:28 
Questiondata access Pin
raquidd2223-Sep-09 11:26
raquidd2223-Sep-09 11:26 
hello
i find a great article about data access, it is to sql

i change the data access to work with sybase
i change the sql object by sybase object


Protected Overloads Sub ExecuteNonQuery(ByRef cmd As AseCommand, ByRef procName As String, ByVal ParamArray

procParams() As IDataParameter)
'Method variablesoutDim cmd As SqlCommand
Dim cnx As AseConnection = Nothing
cmd = Nothing
'Avoids "Use of unassigned variable" compiler error
Try
'Setup command object
cmd = New AseCommand(procName)
cmd.CommandType = CommandType.StoredProcedure
Dim index As Integer = 0
Do While (index < procParams.Length)
cmd.Parameters.Add(procParams(index))
index = (index + 1)
Loop
'Determine the transaction owner and process accordingly
If _esIniciante Then
cnx = New AseConnection(GetConnectionString)
cmd.Connection = cnx
cnx.Open()
Else
cmd.Connection = _txn.Connection
cmd.Transaction = _txn
End If
'Execute the command
cmd.ExecuteNonQuery()
Catch ex As Exception
Throw
Finally
If _esIniciante Then
cnx.Dispose()
End If
If (Not (cmd) Is Nothing) Then
cmd.Dispose()
End If
End Try
End Sub



when call the function ExecuteNonQuery

Public Function Cliente_obtenerPorCedula(ByRef clienteID As Integer, ByVal cedula As String) As DataSet
Dim cmd As AseCommand
ExecuteNonQuery(cmd, "crm_co_clientecedula", _
CreateParameter("@i_cliente_id", AseDbType.Integer, clienteID, ParameterDirection.Output), _
CreateParameter("@i_cedula", AseDbType.NVarChar, cedula))
clienteID = CType(cmd.Parameters("@i_cliente_id").Value, Integer)
cmd.Dispose()
End Function


everything runs fine until invoke the code cmd.Parameters("@i_cliente_id").Value


ocurr the exception --> Run-time exception thrown : System.ObjectDisposedException - Cannot access a disposed object.
Object name: 'AseCommand: '.


the dispose cause exception
Catch ex As Exception
Throw
Finally
If _esIniciante Then
cnx.Dispose()
End If
If (Not (cmd) Is Nothing) Then
cmd.Dispose()
End If
End Try


the cmd.dispose -->System.ObjectDisposedException - Cannot access a disposed object.
the cnx.dispose -->Parameters {"Cannot access a disposed object.Object name: 'AseCommand: '.

while i comment this line, the code work

'If _esIniciante Then
' cnx.Dispose()
'End If
'If (Not (cmd) Is Nothing) Then
' cmd.Dispose()
'End If



where can be the problem ?
the original code is c# and sql that's work fine
me email is raquidd@yahoo.com

regards
sorry for me english

AnswerRe: data access Pin
Abhishek Sur23-Sep-09 12:17
professionalAbhishek Sur23-Sep-09 12:17 
GeneralRe: data access Pin
N a v a n e e t h23-Sep-09 15:47
N a v a n e e t h23-Sep-09 15:47 
GeneralRe: data access Pin
Abhishek Sur23-Sep-09 23:28
professionalAbhishek Sur23-Sep-09 23:28 
GeneralRe: data access Pin
N a v a n e e t h24-Sep-09 5:03
N a v a n e e t h24-Sep-09 5:03 
GeneralRe: data access Pin
Abhishek Sur25-Sep-09 12:16
professionalAbhishek Sur25-Sep-09 12:16 
GeneralRe: data access Pin
raquidd2230-Sep-09 6:27
raquidd2230-Sep-09 6:27 
AnswerRe: data access Pin
N a v a n e e t h23-Sep-09 15:44
N a v a n e e t h23-Sep-09 15:44 
GeneralRe: data access Pin
raquidd2224-Sep-09 6:38
raquidd2224-Sep-09 6:38 
GeneralRe: data access Pin
raquidd2224-Sep-09 7:06
raquidd2224-Sep-09 7:06 
GeneralRe: data access Pin
Abhishek Sur25-Sep-09 12:15
professionalAbhishek Sur25-Sep-09 12:15 
Questionquestions Pin
hasani200723-Sep-09 10:25
hasani200723-Sep-09 10:25 
AnswerRe: questions Pin
Abhishek Sur23-Sep-09 10:32
professionalAbhishek Sur23-Sep-09 10:32 
QuestionNewsletter App Pin
kruegersck23-Sep-09 10:07
kruegersck23-Sep-09 10:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.