|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What to declare a DBNull variable to?"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? -- | +- VB.Net 2003+-- Julian | Show quoteHide quote | Julian wrote:
Show quoteHide quote > I need to convert db field values from "1 - Attempted-Successful" to "Yes", Select Case fldData.Value> "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? > > Case "1 - Attempted-Successful" NewDataValue = "Yes" Case "2 - Attempted-Unsuccessful" NewDataValue = "No" Case Else NewDataValue = System.DBNull.Value End Select 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 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 > > |
|||||||||||||||||||||||