Home All Groups Group Topic Archive Search About

What to declare a DBNull variable to?

Author
26 Mar 2006 2:28 AM
Julian
I need to convert db field values from "1 - Attempted-Successful" to "Yes",
"2 - Attempted-Unsuccessful" to "No" and all other values need to be
NULL-ed. So here's my code:

        Dim strQuery As String = "SELECT tblData.CoPayFundGrant,
tblData.M_DSS_SSA_Benefits, tblData.O_DSS_SSA_Benefits, " & _
            "tblData.Ref_MPS, tblData.Ref_LA, tblData.Ref_DCMH,
tblData.Place_Comm, tblData.Rem_Comm, tblData.Core_Case_Man,
tblData.Ref_DCMH_Case_Man " & _
            "FROM tblData;"
        Dim rsDataManip As ADODB.Recordset = cnnJET.Execute(strQuery)
        With rsDataManip
            If Not .EOF Then
                Dim NewDataValue As Object
                For Each fldData As ADODB.Field In rsDataManip.Fields
                    Select Case fldData.Value
                        Case "1 - Attempted-Successful"
                            NewDataValue = "Yes"
                        Case "2 - Attempted-Unsuccessful"
                            NewDataValue = "No"
                        Case Else
                            NewDataValue = System.DBNull


                    End Select
                Next
            End If
        End With

My question is- what do I declare the temp variable "NewDataValue" as?

PS. Can I do the above using a SQL command?


--
|
+-- Julian
|
+- VB.Net 2003
Show quoteHide quote
|

Author
26 Mar 2006 5:05 AM
Chris
Julian wrote:
Show quoteHide quote
> I need to convert db field values from "1 - Attempted-Successful" to "Yes",
> "2 - Attempted-Unsuccessful" to "No" and all other values need to be
> NULL-ed. So here's my code:
>
>         Dim strQuery As String = "SELECT tblData.CoPayFundGrant,
> tblData.M_DSS_SSA_Benefits, tblData.O_DSS_SSA_Benefits, " & _
>             "tblData.Ref_MPS, tblData.Ref_LA, tblData.Ref_DCMH,
> tblData.Place_Comm, tblData.Rem_Comm, tblData.Core_Case_Man,
> tblData.Ref_DCMH_Case_Man " & _
>             "FROM tblData;"
>         Dim rsDataManip As ADODB.Recordset = cnnJET.Execute(strQuery)
>         With rsDataManip
>             If Not .EOF Then
>                 Dim NewDataValue As Object
>                 For Each fldData As ADODB.Field In rsDataManip.Fields
>                     Select Case fldData.Value
>                         Case "1 - Attempted-Successful"
>                             NewDataValue = "Yes"
>                         Case "2 - Attempted-Unsuccessful"
>                             NewDataValue = "No"
>                         Case Else
>                             NewDataValue = System.DBNull
>
>
>                     End Select
>                 Next
>             End If
>         End With
>
> My question is- what do I declare the temp variable "NewDataValue" as?
>
> PS. Can I do the above using a SQL command?
>
>

Select Case fldData.Value
    Case "1 - Attempted-Successful"
        NewDataValue = "Yes"
    Case "2 - Attempted-Unsuccessful"
        NewDataValue = "No"
    Case Else
        NewDataValue = System.DBNull.Value
End Select
Author
26 Mar 2006 10:21 AM
Julian
My question is- what do I declare the temp variable "NewDataValue" as?
Object?


--
Show quoteHide quote
|
+-- Julian
|


"Chris" <no@spam.com> wrote in message
news:uCsRkLJUGHA.5044@TK2MSFTNGP09.phx.gbl...
> Julian wrote:
>> I need to convert db field values from "1 - Attempted-Successful" to
>> "Yes", "2 - Attempted-Unsuccessful" to "No" and all other values need to
>> be NULL-ed. So here's my code:
>>
>>         Dim strQuery As String = "SELECT tblData.CoPayFundGrant,
>> tblData.M_DSS_SSA_Benefits, tblData.O_DSS_SSA_Benefits, " & _
>>             "tblData.Ref_MPS, tblData.Ref_LA, tblData.Ref_DCMH,
>> tblData.Place_Comm, tblData.Rem_Comm, tblData.Core_Case_Man,
>> tblData.Ref_DCMH_Case_Man " & _
>>             "FROM tblData;"
>>         Dim rsDataManip As ADODB.Recordset = cnnJET.Execute(strQuery)
>>         With rsDataManip
>>             If Not .EOF Then
>>                 Dim NewDataValue As Object
>>                 For Each fldData As ADODB.Field In rsDataManip.Fields
>>                     Select Case fldData.Value
>>                         Case "1 - Attempted-Successful"
>>                             NewDataValue = "Yes"
>>                         Case "2 - Attempted-Unsuccessful"
>>                             NewDataValue = "No"
>>                         Case Else
>>                             NewDataValue = System.DBNull
>>
>>
>>                     End Select
>>                 Next
>>             End If
>>         End With
>>
>> My question is- what do I declare the temp variable "NewDataValue" as?
>>
>> PS. Can I do the above using a SQL command?
>>
>>
>
> Select Case fldData.Value
> Case "1 - Attempted-Successful"
> NewDataValue = "Yes"
> Case "2 - Attempted-Unsuccessful"
> NewDataValue = "No"
> Case Else
> NewDataValue = System.DBNull.Value
> End Select
Author
26 Mar 2006 12:28 PM
Cor Ligthert [MVP]
Julian,

You have sent two messages, no problem can happen, but in my opinion is
stephany giving you the extra answer at the other message. I think because
those are more answered, that you keep your questions at that message.

Thanks in advance,

Cor

Show quoteHide quote
"Julian" <ad***@jdmils.com> schreef in bericht
news:O2xEO8LUGHA.5044@TK2MSFTNGP09.phx.gbl...
> My question is- what do I declare the temp variable "NewDataValue" as?
> Object?
>
>
> --
> |
> +-- Julian
> |
>
>
> "Chris" <no@spam.com> wrote in message
> news:uCsRkLJUGHA.5044@TK2MSFTNGP09.phx.gbl...
>> Julian wrote:
>>> I need to convert db field values from "1 - Attempted-Successful" to
>>> "Yes", "2 - Attempted-Unsuccessful" to "No" and all other values need to
>>> be NULL-ed. So here's my code:
>>>
>>>         Dim strQuery As String = "SELECT tblData.CoPayFundGrant,
>>> tblData.M_DSS_SSA_Benefits, tblData.O_DSS_SSA_Benefits, " & _
>>>             "tblData.Ref_MPS, tblData.Ref_LA, tblData.Ref_DCMH,
>>> tblData.Place_Comm, tblData.Rem_Comm, tblData.Core_Case_Man,
>>> tblData.Ref_DCMH_Case_Man " & _
>>>             "FROM tblData;"
>>>         Dim rsDataManip As ADODB.Recordset = cnnJET.Execute(strQuery)
>>>         With rsDataManip
>>>             If Not .EOF Then
>>>                 Dim NewDataValue As Object
>>>                 For Each fldData As ADODB.Field In rsDataManip.Fields
>>>                     Select Case fldData.Value
>>>                         Case "1 - Attempted-Successful"
>>>                             NewDataValue = "Yes"
>>>                         Case "2 - Attempted-Unsuccessful"
>>>                             NewDataValue = "No"
>>>                         Case Else
>>>                             NewDataValue = System.DBNull
>>>
>>>
>>>                     End Select
>>>                 Next
>>>             End If
>>>         End With
>>>
>>> My question is- what do I declare the temp variable "NewDataValue" as?
>>>
>>> PS. Can I do the above using a SQL command?
>>>
>>>
>>
>> Select Case fldData.Value
>> Case "1 - Attempted-Successful"
>> NewDataValue = "Yes"
>> Case "2 - Attempted-Unsuccessful"
>> NewDataValue = "No"
>> Case Else
>> NewDataValue = System.DBNull.Value
>> End Select
>
>