C
Cameron Frasnelly
The second to last lin of code in the below sub is causing VS2003 to tell me
that "Name 'SqlDR' is not declared" when obviously it is. It's also used
just fine in the main code... any ideas????
*****CODE BELOW****
Public Sub loadWOFromKEY()
Try
'Setup the connection
Dim connObj As SqlConnection = New
SqlConnection(OpsDB_Module.ConnectionString())
'Setup the command to execute
Dim cmdObj As SqlCommand = New SqlCommand("spWorkOrderFull_byKEY", connObj)
cmdObj.CommandType = CommandType.StoredProcedure
'----add parameter to stored procedure
Dim myParm As SqlParameter = cmdObj.Parameters.Add("@WorkOrderKEY",
SqlDbType.Int)
myParm.Value = 3333
'Open the connection
connObj.Open()
'Grab the data into a reader object
Dim sqlDR As SqlDataReader = cmdObj.ExecuteReader()
If sqlDR.HasRows = False Then
Me._ProblemTitle = "No Rows"
End If
'----LOTS O WORK - Get the column values
Dim tmpString As String = sqlDR.GetName(0) 'Testing
sqlDR.Read()
Me._WorkOrderKEY = sqlDR.GetInt16(0)
Me._Problem = sqlDR.GetString(sqlDR.GetOrdinal("Problem"))
Me._Priority = sqlDR.GetInt16(sqlDR.GetOrdinal("Priority"))
Me._ReceiveNOW = sqlDR.GetDateTime(sqlDR.GetOrdinal("ReceiveNOW"))
sqlDR.Close()
connObj.Close()
Catch ex As Exception
Me._Problem = ex.Message.ToString
Finally
sqlDR.Close()
End Try
that "Name 'SqlDR' is not declared" when obviously it is. It's also used
just fine in the main code... any ideas????
*****CODE BELOW****
Public Sub loadWOFromKEY()
Try
'Setup the connection
Dim connObj As SqlConnection = New
SqlConnection(OpsDB_Module.ConnectionString())
'Setup the command to execute
Dim cmdObj As SqlCommand = New SqlCommand("spWorkOrderFull_byKEY", connObj)
cmdObj.CommandType = CommandType.StoredProcedure
'----add parameter to stored procedure
Dim myParm As SqlParameter = cmdObj.Parameters.Add("@WorkOrderKEY",
SqlDbType.Int)
myParm.Value = 3333
'Open the connection
connObj.Open()
'Grab the data into a reader object
Dim sqlDR As SqlDataReader = cmdObj.ExecuteReader()
If sqlDR.HasRows = False Then
Me._ProblemTitle = "No Rows"
End If
'----LOTS O WORK - Get the column values
Dim tmpString As String = sqlDR.GetName(0) 'Testing
sqlDR.Read()
Me._WorkOrderKEY = sqlDR.GetInt16(0)
Me._Problem = sqlDR.GetString(sqlDR.GetOrdinal("Problem"))
Me._Priority = sqlDR.GetInt16(sqlDR.GetOrdinal("Priority"))
Me._ReceiveNOW = sqlDR.GetDateTime(sqlDR.GetOrdinal("ReceiveNOW"))
sqlDR.Close()
connObj.Close()
Catch ex As Exception
Me._Problem = ex.Message.ToString
Finally
sqlDR.Close()
End Try