Jump to content
Sign in to follow this  
Krikov

Add Data To MDB File Help

Recommended Posts

Krikov

Hello I ave A Gui With Sum InpotBox And ComboBox What is Wrong With That Case

Case $Update
$Col1 = GUICtrlRead($Card_Owner); Read From A ComboBox
$Col2 = GUICtrlRead($Date_Buy); Read From A Monthly Calander
$Col3 = GUICtrlRead($Total_Cost); Number From InputBox
$Col4 = GUICtrlRead($Number_Pays);Number Form ComboBox
$Col5 = GUICtrlRead($Each_Pay); Number From Input Box
$Col6 = GUICtrlRead($Finish_Date);Date
$Col7 = GUICtrlRead($What); Text Form InputBox
$Col8 = GUICtrlRead($At_The); Text Form InputBox
$AllCol ="'"&$Col1&"','"&$Col2&"','"&$Col3&"','"&$Col4&"','"&$Col5&"','"&$Col6&"','"&$Col7&"','"&$Col8
$Sql3 = "Insert Into Credit_TBL Values ("&$AllCol&")"
$oRs3 = ObjCreate("ADODB.Recordset")
$oRs3.Execute ($Sql3,$oConn,2,2)
$ors3.Close
MsgBox(0,"","Data Insrted")

Thanks Krikov


[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites
Sardith

Posting more of your code would be great.

Also, what line is it getting to befor the script fails/errors?

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Krikov

This is all the Code.

BTW Some if the Word in The Labels is in Hebrew.

#include<GuiConstants.au3>
#include<Array.au3>
#include <Date.au3>

Dim $oRs1,$oConn,$Splited_date
$Form1 = GUICreate("AForm1",633,489,193,115)
$Date_Buy = GUICtrlCreateMonthCal("",432,144,191,154)
$Label1 = GUICtrlCreateLabel("ת×ר×× ×¨××ש×",496,120,78,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Koteret = GUICtrlCreateLabel("××¢×§× ××צ××ת",192,8,227,50)
GUICtrlSetFont(-1,30,800,4,"Arial")
$Label2 = GUICtrlCreateLabel("××¢× ××ר××ס",352,144,69,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Label3 = GUICtrlCreateLabel("×¡× ×תש×××",360,184,62,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Total_Cost = GUICtrlCreateInput("",232,184,121,21)
$Card_Owner = GUICtrlCreateCombo("",200,144,145,25)
$Label4 = GUICtrlCreateLabel("×ספר תש×××××",336,224,89,25)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Number_Pays = GUICtrlCreateCombo("1",240,224,89,25)
$Label5 = GUICtrlCreateLabel("×× ×ª×©×××",360,264,57,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Each_Pay = GUICtrlCreateInput("",232,264,121,21)
$Label6 = GUICtrlCreateLabel("ת×ר×× ×¤×¨×¢××",344,304,73,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$Finish_Date = GUICtrlCreateInput("",216,304,121,21)
$Label7 = GUICtrlCreateLabel("ס××ת ××צ××",352,344,71,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$What = GUICtrlCreateInput("",96,344,249,21)
$Label8 = GUICtrlCreateLabel("×ק×× ×¨××ש×",352,384,71,20)
GUICtrlSetFont(-1,10,800,0,"Arial")
$At_The = GUICtrlCreateInput("",224,384,121,21)
$Update = GUICtrlCreateButton("×¢×××",536,440,75,25,0)
GUISetState(@SW_SHOW)
$oConn = ObjCreate("ADODB.Connection")
$oRs1 = ObjCreate("ADODB.Recordset")
$oRs2 = ObjCreate("ADODB.Recordset")
$oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\DB\DataBase.mdb")
$Sql1 = "Select * From Card_Owner_TBL Where Index = Index"
$oRs1.Open ($Sql1,$oConn,2,2)
Do 
    GUICtrlSetData($Card_Owner,$oRs1.Fields(1).Value)
    $oRs1.MoveNext
Until $oRs1.EOF
$oRs1.Close
$Sql2 = "Select * From Number_Pays_TBL Where Index = Index Order By Index"
$oRs2.Open ($Sql2,$oConn,2,2)
Do 
    GUICtrlSetData($Number_Pays,$oRs2.Fields(1).Value)
    $oRs2.MoveNext
Until $oRs2.EOF
$oRs2.Close

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Number_Pays
            $Date_calc = GUICtrlRead($Date_Buy)
            $Splited_date = StringSplit($Date_calc,"/")
            If $Splited_date[3] < 10 Then
                $Finish_Date_Calc = _DateAdd('M',GUICtrlRead($Number_Pays) -1 ,$Date_calc)
                GUICtrlSetData($Finish_Date,$Finish_Date_Calc)
            Else
                $Finish_Date_Calc = _DateAdd('M',GUICtrlRead($Number_Pays),$Date_calc)
                GUICtrlSetData($Finish_Date,$Finish_Date_Calc)
            EndIf
        Case $Update
            Dim $AllCol[1]
            $Col1 = GUICtrlRead($Card_Owner)
            $Col2 = GUICtrlRead($Date_Buy)
            $Col3 = GUICtrlRead($Total_Cost)
            $Col4 = GUICtrlRead($Number_Pays)
            $Col5 = GUICtrlRead($Each_Pay)
            $Col6 = GUICtrlRead($Finish_Date)
            $Col7 = GUICtrlRead($What)
            $Col8 = GUICtrlRead($At_The)
            $AllCol ="'"&$Col1&"','"&$Col2&"','"&$Col3&"','"&$Col4&"','"&$Col5&"','"&$Col6&"','"&$Col7&"','"&$Col8
            $Sql3 = "Insert Into Credit_TBL Values ("&$AllCol&")"
            $oRs3 = ObjCreate("ADODB.Recordset")
            $oRs3.Open ($Sql3,$oConn,2,2)
            $oRs3.AddNew
    EndSwitch
WEnd

KRIKOV

Edited by Krikov

[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites
ptrex
Krikov

Can Some One Give me an Example Base on Read The Value of A InputBox And Then

add Them to the DataBase (MSAccess)

Krikov


[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites
Krikov

BumpUP


[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×