Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hello..

this is the part i want to turn into strings:

CSS
ADR;WORK;PREF:;;Sjoerd Veltmanstraat 15;Drachten;;9203 NJ
ENCODING=QUOTED-PRINTABLE:Sjoerd Veltmanstraat 15



Sjoerd Veltmanstraat 15 must be strAdres
Drachten must be strPlaats
and 9203 NJ must be strPostcode.

This is what I have to input into the database..:

VB
strInsert = "INSERT INTO Relaties (B22_relnr, B22_rel_soort, B22_naam, B22_voornaam_etc, " _
                 & "B22_adres, B22_postcode, B22_plaats, B22_telefoon1, B22_telefoon2, " _
                 & "B22_mobielnr, B22_faxnummer, B22_email, B22_www_adres, B22_zoeknaam) " _
                 & " VALUES (" & intNummer & ", '" & strSoort & "', '" & strNaam _
                 & "', '" & strVoornaam & "', '" & strAdres _
                 & "', '" & strPostcode & "', '" & strPlaats & "', '" & strTelWerk _
                 & "', '" & strTelThuis & "', '" & strMobiel & "', '" & strFaxWerk _
                 & "', '" & strMail & "', '" & strUrlWerk & "', '" & strZoek & "' )"



This code is ok and it's been working Except for the adres, plaats, postcode.
After I have solved this I can display the website and email adres.

For strings I have this:

VB
Dim strBestand As String = " "                          'Locatie + naam van het bestand:
Dim strRegel As String = String.Empty                   'Regel/lijn:
Dim strWaarde() As String = Nothing                     'de inhoud van de regels/lijnen:

Dim objReader As System.IO.StreamReader = Nothing, _
    sbBuilder As System.Text.StringBuilder = Nothing

'Variabelen:
'--------------------------------
Dim intNummer As Integer = "20102012"                     'een nummer kan maar één keer voorkomen:
Dim strSoort As String = "D"                            'D = Debiteuren, C = Crediteuren, R = Relaties:
Dim strNaam As String = " "                             'de naam die in de V-Card staat:
Dim strVoornaam As String = " "                         'Voornaam:

Dim strTelWerk As String = " "                          'Telefoonnummer zakelijk:
Dim strTelThuis As String = " "                         'Telefoonnummer privé:

Dim strMobiel As String = " "                           'Mobiel nummer:
Dim strOverig As String = " "                           'Overige telefoon nummers:

Dim strFaxWerk As String = " "                          'Fax zakelijk + privé:
Dim strFaxThuis As String = " "

Dim strPostcode As String = " "                        'Adresgegevens:
Dim strPlaats As String = " "
Dim strAdres As String = " "

Dim strUrlThuis As String = " "                         'Website, privé en zakelijk:
Dim strUrlWerk As String = " "

Dim strMail As String = " "                             'E-mail adres:
Dim strZoek As String = "testtest"                      'Zoeknaam: eerste 4 letters van naam en v.d. woonplaats:




I use Cases to Insert the strings:

SQL
Select Case UCase(strWaarde(0))             '(0) = het gedeelte voor ":" en (1) komt daarna:
    Case "BEGIN", "VERSION", "END"
        ', "ENCODING=QUOTED-PRINTABLE"

    Case "N"
        strNaam = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbTab)

    Case "FN"                               'Voornaam:
        strVoornaam = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "TEL;WORK;VOICE"                   'Telefoon op het werk:
        If blnDubbel = False Then
            strTelWerk = strWaarde(1)
            sbBuilder.Append(strWaarde(1) & vbTab)
            blnDubbel = True
        End If

    Case "TEL;HOME;VOICE"                   'Telefoon thuis:
        strTelThuis = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "TEL;CELL;VOICE"                   'Mobiele telefoon:
        strMobiel = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbTab)

    Case "TEL;VOICE"                        'Overige nummers:
        strOverig = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "TEL;WORK;FAX"                     'Fax op het werk:
        strFaxWerk = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbTab)

    Case "TEL;FAX"                          'Fax thuis:
        strFaxThuis = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "ADR;WORK;PREF:;;"                  'Adresgegevens:
        strAdres = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "ENCODING=QUOTED-PRINTABLE:"
        strAdres = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "URL;HOME:"                        'Website Thuis:
        strUrlThuis = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbTab)

    Case "URL;WORK:"                        'Website Werk:
        strUrlWerk = strWaarde(1)
        sbBuilder.Append(strWaarde(1) & vbCrLf)

    Case "EMAIL;PREF;INTERNET:"             'Email adres:
        strMail = strWaarde(1)
        sbBuilder.Append(strWaarde(1))

    Case Else
        sbBuilder.Append(strWaarde(1) & vbCrLf)

End Select



can someone help me out?
Thanks
Posted
Comments
Shahan Ayyub 17-Jun-12 16:09pm    
how do you parse the string ? i.e., "strWaarde(0)" which is passed in "select case". Once you have this case:
"ADR;WORK;PREF:;;"
the substring till the next ";" will be your desired result. Have you tried that ?
OdeJong 18-Jun-12 9:17am    
That's what I am trying to do

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900