04-01-2008, 14:24
|
|
|
|
חבר מתאריך: 25.10.05
הודעות: 1,508
|
|
1) vb6
2)
זו השורה שהדיבאג מסמן:
קוד:
oConn.Execute("INSERT into sapak (name, cphone, company, phone, fax, id) VALUES ('" & sapak.Text & "', '" & cphone.Text & "', '" & comapny.Text & "', '" & phone.Text & "', '" & fax.Text & "', id)")
יש לי בטופס flexgrid כמה כפתורים ואדיטים,
זה הקוד המלא:
(קצת מטומטם כנראה :|)
קוד:
Private Sub Form_Load()
Dim i As Integer
i = 0
Do While (i <= 4)
list_s.ColWidth(i) = 1957
i = i + 1
Loop
list_s.Visible = False
list_s.CellAlignment = 7
list_s.Visible = True
list_s.TextMatrix(0, 0) = "שם הספק"
list_s.TextMatrix(0, 1) = "מס' פלא"
list_s.TextMatrix(0, 2) = "שם החברה"
list_s.TextMatrix(0, 3) = "טלפון החברה"
list_s.TextMatrix(0, 4) = "מס' פקס"
Dim oConn As ADODB.Connection
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=sapak.mdb; DefaultDir=c:\" & ";"
Dim oRs As ADODB.Recordset
Set oRs = oConn.Execute("SELECT * FROM sapak")
Dim strrow As String
Do While (oRs.EOF = False)
strrow = oRs.Fields("name") & vbTab & oRs.Fields("cphone") & vbTab & oRs.Fields("company") & vbTab & oRs.Fields("phone") & vbTab & oRs.Fields("fax")
list_s.AddItem (strrow)
oRs.MoveNext
Loop
oRs.Close
Set oRs = Nothing
oConn.Close
Set oConn = Nothing
End Sub
Private Sub add_Click()
Dim oConn As ADODB.Connection
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=sapak.mdb; DefaultDir=c:\" & ";"
Dim oRs As ADODB.Recordset
Set oRs = oConn.Execute("SELECT id FROM sapak ORDER BY id DESC")
Dim id As Integer
If (oRs.EOF = True) Then
id = 1
Else
id = oRs.Fields(id) + 1
End If
Set oRs = oConn.Execute("INSERT into sapak (name, cphone, company, phone, fax, id) VALUES ('" & sapak.Text & "', '" & cphone.Text & "', '" & comapny.Text & "', '" & phone.Text & "', '" & fax.Text & "', id)")
End Sub
ולפנים, מצטער יכול להיות שלא שמתי לב לvba ו שקראתי ולא שמתי לב לa , מצטער.
תודה רבה.
_____________________________________
חתימתי העצומה בגודלה הוסרה ע"י השליט הבלתי מעורער שימי, למי שיש בעיה שיפנה אליו.
ד אַל תַּעַן כְּסִיל כְּאִוַּלְתּוֹ פֶּן תִּשְׁוֶה לּוֹ גַם אָתָּה. ה עֲנֵה כְסִיל כְּאִוַּלְתּוֹ פֶּן יִהְיֶה חָכָם בְּעֵינָיו
|