2012-08-28 32 views
0
Private Sub cmdAdd_Click() 


Dim rs As ADODB.Recordset 

Dim strsql As String 

strsql = "insert into Issue_Tab(Startno, End no, Issuedate, Brncode) Values(' " & txtstartno.Text & " ' , ' " & 
txtendo.Text & " ' , ' " & txtdate.Text & " ' , where Brncode = ' " & txtbrncode.Text & " ' ) " 

Set rs = pcnl.Execute(strsql) 

Set rs = Nothing 

MsgBox " Saved" 

Me.filllistview 

End Sub 

Sub filllistview() 

strsql = "select * from Issue_Tab" 

Set rs = pcnl.Execute(strsql) 

ListView1.ListItems.Clear 

Do While Not rs.EOF 

Set Item = ListView1.ListItems.Add(, , rs!Startno) 

Item.SubItems(1) = rs!Endno & "" 

Item.SubItems(2) = rs!Issuedate & "" 

Item.SubItems(3) = rs!Brncode & "" 

rs.MoveNext 

Loop 

Set rs = Nothing 

End Sub 


Private Sub Command1_Click() 

Dim strsql As String 

Dim rs As ADODB.Recordset 

strsql = " Delete from Issue_tab where Brncode = ' " & txtbrncode.Text & " ' " 

Set rs = pcnl.Execute(strsql) 

Set rs = Nothing 

MsgBox "Delete" 

Me.filllistview 

End Sub 

Private Sub Form_Load() 

Me.filllistview 

End Sub 


Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem) 

With Item 

txtstartno.Text = Item 

txtendno.Text = .SubItems(1) 

txtdate.Text = .SubItems(2) 

txtbrncode.Text = .SubItems(3) 

End With 

End Sub 



Private Sub txtupdate_Click() 

Dim strsql As String 

Dim rs As ADODB.Recordset 

strsql = " update Issue_Tab set startno = ' " & txtstartno.Text & " ' , Endno = ' " & txtendno.Text & " ' , Issuedate = ' " & txtdate.Text & " ' where Brncode = ' " & txtbrncode.Text & " ' " 

Set rs = pcnl.Execute(strsql) 

Set rs = Nothing 

MsgBox " Updated" 

Me.filllistview 

End Sub 

「」「」我在我的項目做這種編碼&我也沒有添加模塊在它....但與編碼的問題是,無論是它顯示任何錯誤也沒有它的工作,並沒有顯示我的SQL數據庫的變化..... 所以請儘快幫我出來,因爲我必須在公司提交項目.......MySQL和VB6.0項目

在此先感謝..幫助我進入這.. ..!

+0

使用調試器? – JohnB

+1

@Spudley,無關緊要,人們可以自由編程/使用任何他們覺得喜歡的語言,stackoverflow適用於所有語言...... –

+0

@Spudley至少人們不需要下載整個.net框架來運行你的程序,那麼什麼是在屁股疼 – EaterOfCode

回答

0

我有最好的暴露你的問題有幾個問題:

你應該檢查MySQL的日誌
  1. 第一,並且他們啓用?
  2. MySQL是否運行?
  3. 你是怎麼安裝你的mysql的?它是香草嗎?
  4. 你是否安裝了ODBC的MySQL插件?
  5. 您的控制檯/動態日誌是否在vb6上啓用?嘗試一些迴應來看看發生了什麼。
+0

老兄我下載了我的SQL服務器5.5 simulatneuosly,也下載了odbc連接器3.51 .......所以plz exlain這個! 昨天我使用adodc除了adodb連接.... 但有問題在運行添加編碼其日期數據類型顯示錯誤,所以exlain這個y它顯示錯誤! – user1629521