2013-03-13 45 views
-1

我是新來的VB,我想添加值/詳細信息到oracle數據庫,但我在這裏面臨一些問題。我想存儲來自文本框的信息,我已經創建了與Oracle DB的連接並存儲它們。我希望有人會指導我。謝謝。保存oracle數據庫中的值使用VB6

Private Sub Command1_Click() 
    Dim oconn As ADODB.Connection 
    Dim rs As ADODB.Recordset 
    Dim strSQL As String 

    Set oconn = New ADODB.Connection 
    Set rs = New ADODB.Recordset 

    oconn.Open "DRIVER = ODBC;DSN=sss;UID=sss;PWD=sss;DATABASE=sss" 

    strSQL = "INSERT INTO ZZZJUNKPERSON (ID_NO, NAME, GENDER, ADDRESS, PHONE_NO) " _ 
    & "VALUES ('" & Form2.Text1.Text & "', " _ 
    & "' " & Form2.Text2.Text & "', " _ 
    & "' " & Form2.Text3.Text & "', " _ 
    & "' " & Form2.Text4.Text & "', " _ 
    & "' " & Form2.Text5.Text & "')" 


End Sub 
+1

所以,你忘了實際運行查詢? – Deanna 2013-03-13 10:52:57

+0

就像我剛纔所說,我是新來的,我做了,忘了所有這些東西......哈哈......無論如何,謝謝...... – user2081680 2013-03-14 01:02:13

回答

2

執行的SQL指令,是這樣的:

oconn.Execute strSQL