Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim strInsert = "INSERT INTO Relaties (B22_relnr, B22_rel_soort, B22_naam, B22_voornaam_etc, B22_adres, B22_postcode, B22_plaats, B22_telefoon1, B22_mobielnr, B22_faxnummer, B22_email, B22_www_adres, B22_zoeknaam) _"

                    ('" & Nummer & "', '" & Relatiesoort & "', '" & Naam & "', '" & Voornaam & "', '" & Adres & "', '" & Postcode & "', '" & Woonplaats & "', '" & Telefoon & "', '" & Mobiel & "', '" & Fax & "', '" & E-mail & "', '" & Website & "')"

                    Select Case UCase(strWaarde(0))                         '(0) = het gedeelte voor ":" en (1) komt daarna
                        Case "BEGIN", "VERSION", "END"                      'De waarden die niet worden getoond.

                        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:"                               'Adres
                            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
                Loop
                objReader.Close()
                frmVCard.txtVCard.Text = sbBuilder.ToString

            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fout...")

            Finally
                objReader.Dispose()
                sbBuilder = Nothing
            End Try
        End If
    End Sub


My Tablename = Relaties
Fields or:
everything with B22_...etc
What i want to fill is: the database, connected with my app.
everything i have insert, must be a new record on the database..

i hope it's clear now.. thanks, and i wil try by myself.
Posted
Updated 6-Jun-12 23:43pm
v4
Comments
Sandeep Mewara 5-Jun-12 10:01am    
Did you try by yourself?
OdeJong 5-Jun-12 10:18am    
yes, a little... and i'm still trying to figure it out.
maby you can send me in the good direction?
but enough for now, im going work on it thursday again.
Maciej Los 5-Jun-12 15:48pm    
Not clear! Where do you want to insert this command? What's the structure of your table?

Basic knowledge: INSERT[^] and Create Stored Procedures[^]

Upgrade your question and i'll update my answer ;)

[EDIT]
First of all, read this:
Commands and parameters[^]
SqlParameterCollection.AddWithValue Method [^]

Then, replace your query with:
SQL
INSERT INTO Relaties (B22_relnr, B22_rel_soort, B22_naam, B22_voornaam_etc, B22_adres, B22_postcode, B22_plaats, B22_telefoon1, B22_mobielnr, B22_faxnummer, B22_email, B22_www_adres, B22_zoeknaam)
VALUES(@relnr, @rel_soort, @naam, @voornaam_etc, @adres, @postcode, @plaats, @telefoon1, @mobielnr, @faxnummer, @email, @www_adres, @zoeknaam)


After SELECT... CASE... END SELECT build your command as is shown in the second links.
[/EDIT]
 
Share this answer
 
v2
Comments
VJ Reddy 5-Jun-12 19:55pm    
Good references. 5!
Maciej Los 6-Jun-12 9:16am    
Thank you, VJ ;)
Sandeep Mewara 7-Jun-12 16:22pm    
5+ Good answer.
Maciej Los 7-Jun-12 16:27pm    
Thank you, Sandeep ;)
SQL
'INSERT & VALUES lijst:
                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 _
                                & "', '" & strPostcode & "', '" & strPlaats & "', '" & strTelWerk _
                                & "', '" & strTelThuis & "', '" & strMobiel & "', '" & strFaxWerk _
                                & "', '" & strMail & "', '" & strUrlWerk & "', '" & strZoek & "' )"
 
Share this answer
 

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