Visual Basic Database Homework
-
Thursday, May 12, 2011 8:49 PM
I just need the coding for the change thing. I'm lost. I made Input, Analysis, Deletion, End and now I need change. Please help.
Imports System.Console Module Module1 Dim vorname, nachname, strasse, plz, ort, record, arecord, leer, avorname, anachname, astrasse, aplz, aort, snachname, reak, lnachname, arec As String Dim fn, auswahl, gefunden As Integer Sub Main() Do Clear() CursorTop = 5 CursorLeft = 5 Write("Programmfunktion waehlen =>> (1) EINGABE ") CursorTop = 6 CursorLeft = 5 Write(" (2) AUSWERTUNG") CursorTop = 7 CursorLeft = 5 Write(" (3) LOESCHEN ") CursorTop = 8 CursorLeft = 5 Write(" (4) AENDERN ") CursorTop = 9 CursorLeft = 5 Write(" (5) ENDE ") auswahl = ReadLine() Select Case auswahl Case 1 Call eingabe() Case 2 Call auswertung() Case 3 Call loeschen() Case 4 Call aendern() Case 5 Call ende() End Select Loop End Sub Sub eingabe() Clear() CursorTop = 5 CursorLeft = 10 Write("VORNAME:") CursorTop = 5 CursorLeft = 25 vorname = ReadLine() CursorTop = 7 CursorLeft = 10 Write("NACHNAME:") CursorTop = 7 CursorLeft = 25 nachname = ReadLine() CursorTop = 9 CursorLeft = 10 Write("STRASSE:") CursorTop = 9 CursorLeft = 25 strasse = ReadLine() CursorTop = 11 CursorLeft = 10 Write("PLZ:") CursorTop = 11 CursorLeft = 25 plz = ReadLine() CursorTop = 13 CursorLeft = 10 Write("ORT:") CursorTop = 13 CursorLeft = 25 ort = ReadLine() leer = Space(20) vorname = vorname + leer vorname = Left(vorname, 20) nachname = nachname + leer nachname = Left(nachname, 20) strasse = strasse + leer strasse = Left(strasse, 20) plz = plz + leer plz = Left(plz, 5) ort = ort + leer ort = Left(ort, 20) record = vorname + nachname + strasse + plz + ort MsgBox(record) fn = FreeFile() FileOpen(fn, "c:\adressennet.dat", OpenMode.Append) PrintLine(fn, record) FileClose(fn) ReadLine() End Sub Sub auswertung() Clear() CursorTop = 5 CursorLeft = 10 Write("NACHNAME:") CursorTop = 5 CursorLeft = 25 snachname = ReadLine() fn = FreeFile() FileOpen(fn, "c:\adressennet.dat", OpenMode.Append) gefunden = 0 While Not EOF(fn) Input(fn, arecord) avorname = Left(arecord, 20) anachname = Mid(arecord, 21, 20) astrasse = Mid(arecord, 41, 20) aplz = Mid(arecord, 61, 5) aort = Mid(arecord, 66, 20) If Left((snachname + Space(20)), 20) = anachname Then gefunden = 1 Clear() CursorTop = 5 CursorLeft = 10 Write("VORNAME: " + avorname) CursorTop = 7 CursorLeft = 10 Write("NACHNAME: " + anachname) CursorTop = 9 CursorLeft = 10 Write("STRASSE: " + astrasse) CursorTop = 11 CursorLeft = 10 Write("PLZ: " + aplz) CursorTop = 13 CursorLeft = 10 Write("ORT: " + aort) reak = ReadLine() End If End While If gefunden = 0 Then Clear() CursorTop = 5 CursorLeft = 15 Write("SUCHBEGRIFF NICHT VORHANDEN") reak = ReadLine() End If FileClose(fn) ReadLine() End Sub Sub ende() End End Sub Sub loeschen() Clear() CursorTop = 5 CursorLeft = 10 Write("NACHNAME:") CursorTop = 5 CursorLeft = 25 lnachname = ReadLine() lnachname = lnachname + Space(20) lnachname = Left(lnachname, 20) fn = FreeFile() FileOpen(fn, "c:\adressennet.dat", OpenMode.Input) FileOpen(fn + 1, "c:\adressennet.dat", OpenMode.Output) While Not EOF(fn) Input(fn, arec) anachname = Mid(arec, 21, 20) If lnachname <> anachname Then PrintLine(fn + 1, arec) Else CursorTop = 25 CursorLeft = 1 Write("RECORD " + lnachname + " WIRD GELOESCHT") ReadLine() End If End While FileClose(fn) FileClose(fn + 1) Shell("cmd /c del c:\adressennet.dat") Shell("cmd /c ren C:\adressennet1.dat adressennet.dat") End Sub Sub aendern() I'm lost here. ??? End Sub End Module
- Moved by Mike FengMicrosoft Contingent Staff Monday, May 16, 2011 10:14 AM German (From:Visual Basic Language)
All Replies
-
Friday, May 13, 2011 6:29 AM
Deny,
I think you are better of in the German language forum.
Where you probably are easier of telling your problem.
Choose for that in top of this forum Deutschland, maybe you live in Austria, Schweitz, Belgium or Tirol but you know this forum is done by those who only know the small world of Walt Disney so they don't write the language, but one of the countries where they know that the language is spoken.
Did you know that they speak also a kind of English in England?
:-)
Success
Cor- Marked As Answer by Mike FengMicrosoft Contingent Staff Monday, May 16, 2011 10:13 AM
-
Friday, May 13, 2011 5:52 PMThanks.
-
Monday, September 24, 2012 7:07 PMI was also having a problem changing and updating existing records and after a while of trying many different things I finnally made a Primary Key in my database and now it works great :)

