By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

What to declare a DBNull variable to?

P: n/a
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
|
Mar 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
Mar 26 '06 #2

P: n/a
My question is- what do I declare the temp variable "NewDataValue" as?
Object?
--
|
+-- Julian
|
"Chris" <no@spam.com> wrote in message
news:uC**************@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

Mar 26 '06 #3

P: n/a
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

"Julian" <ad***@jdmils.com> schreef in bericht
news:O2**************@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:uC**************@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


Mar 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.