Results 1 to 18 of 18

Thread: [RESOLVED] I Need some advice and help

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Resolved [RESOLVED] I Need some advice and help

    hello, i am creating a simple registration database and i used the adodc component

    i made a database in ms access with tables

    pin
    mobile number
    date registered
    expiry date
    now, i have 4 TextBox in my vb Form1 ; txtPin,txtMobileNumber,txtDateR,txtEDate and 6 Command Button ; add pin,save pin,delete account,update account,cancel,edit account

    first i saved 5 pins in my database..

    Example:

    1111111111
    2222222222
    3333333333
    4444444444
    5555555555
    now, i have 2 TextBox ; txtReceived_MobileNumber,txtReceived_Message

    if received a message from txtReceived_Message
    with the format: PowSMS 3333333333 i want this 3333333333 find first in my database if this is exist, if exist i want the mobile number from txtReceived_MobileNumber register in pin 3333333333 also appear the registered date and expiry date..

    Thanks and Advance

    br

  2. #2
    Lively Member okosv's Avatar
    Join Date
    Sep 2006
    Posts
    95

    Re: I Need some advice and help

    Use SQL query

  3. #3
    Lively Member okosv's Avatar
    Join Date
    Sep 2006
    Posts
    95

    Re: I Need some advice and help

    Using this code you'll get just '3333333333'
    VB Code:
    1. strRecievedMessage="PowSMS 3333333333"
    2. strRecievedMessage=Replace(strRecievedMessage,"PowSMS","")
    3. strRecievedMessage=Trim(strRecievedMessage)
    Than using sql query search in database, etc...

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    anyone can help with this? sample code etc.. in newbie in this field

    br

  5. #5
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: I Need some advice and help

    PowSMS 3333333333, is this should check your pin in the database. Use Okosv's code to get this number alone and use
    VB Code:
    1. Sql = "Select * From YourTableName Where Pin = '" & strReceivedMessage & "'"
    2. Rs.Open Sql, Cn, .....
    3. If Not Rs.EOF Then
    4.     MsgBox "Mobile Number : " & (rs!MobileNumber & "") & " Date Registered : " & (rs!DateRegistered & "") & " Expiry Date : " & (Rs!ExpiryDate & "")
    5. Else
    6.     MsgBox "No Matching PIN Found in the Database !"
    7. End If
    8. Rs.Close
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  6. #6
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: I Need some advice and help

    This should do it...

    'set Reference "Microsoft ActiveX Data Objects 2.6 Library"
    'create conection object and connect to DB
    Dim conDB As ADODB.Connection
    Set conDB = New ADODB.Connection
    'I use a ADO contole to build the connection string
    conDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\gaisrun\gais.mdb;Persist Security Info=False"
    Dim rsRecset As ADODB.Recordset
    Set rsRecset = New ADODB.Recordset

    txtReceived_Message.Text = Replace(txtReceived_Message.Text, "PowSMS", "")
    rsRecset.Open "Select * from table where pin = '" & Trim(txtReceived_Message.Text), conDB 'Add single quotes if pin is of type text
    If rsRecset.EOF = False Then
    rsRecset.MoveFirst
    'Good idea to make your table fields one word
    txtPin.Text = rsRecset!pin
    txtMobileNumber.Text = rsRecset!mobileNumber
    txtDateRegistered.Text = rsRecset!DateRegistered
    txtExpiryDate.Text = rsRecset!expiryDate
    End If
    rsRecset.Close
    Last edited by Green Africa; Sep 28th, 2006 at 02:00 AM.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    thanks guys for your help..

    sql code, can be use in adodc?

  8. #8
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: I Need some advice and help

    No you create an ADODB.Recordset
    ie.
    Dim rsRecset As ADODB.Recordset
    Set rsRecset = New ADODB.Recordset

    rsRecset.Open "Select * from table"

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    @Green Africa

    opss no idea with, can you make sample source code? with the same procedure of my post

    thanks and advance

    br

  10. #10
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: I Need some advice and help

    Im just putting the above codes into a proc...
    VB Code:
    1. Private Sub DisplayDetails()
    2.     strRecievedMessage=Replace(txtReceived_Message,"PowSMS","")
    3.     'set Reference "Microsoft ActiveX Data Objects 2.6 Library"
    4.     'create conection object and connect to DB
    5.     Dim conDB As ADODB.Connection
    6.     Set conDB = New ADODB.Connection
    7.     'I use a ADO contole to build the connection string
    8.     conDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\gaisrun\gais.mdb;Persist Security Info=False"
    9.     Dim rsRecset As ADODB.Recordset
    10.     Set rsRecset = New ADODB.Recordset
    11.     rsRecset.Open "Select * from table where pin = '" & Trim(strReceivedMessage) & "'", conDB  
    12.     If Not rsRecset.EOF Then
    13.         rsRecset.MoveFirst
    14.         'Good idea to make your table fields one word
    15.         txtPin.Text = rsRecset!pin
    16.         txtMobileNumber.Text = rsRecset!mobileNumber
    17.         txtDateRegistered.Text = rsRecset!DateRegistered
    18.         txtExpiryDate.Text = rsRecset!expiryDate
    19.     End If
    20.     rsRecset.Close
    21. End Function
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    can you make it in source and zip then upload here so that i can check it properly.. thanks guys for your time helping me..

  12. #12
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: I Need some advice and help

    Ok hope this helps
    Attached Files Attached Files

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    thanks a lot..

    i will try.. ill be back in 1 hour..

    br

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    @Green Africa

    hi, tried your code and it works fine, how to add data from table accounts with sql? like add,save,update,delete

    br,

  15. #15
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: I Need some advice and help

    add & save\update is almost the same.

    You need to open your recordset for update ie rsRecset.Open "Select * from table where pin = '" & Trim(strReceivedMessage) & "'", conGais, adOpenDynamic, adLockOptimistic

    then for Insert\Add

    rsRecset.AddNew

    then assign all the values to the recordset ie

    rsRecset!Pin = txtPin.Text
    rsRecset!mobileNumber = txtMobileNumber

    after you assigned all the information your save it to the database by

    rsRecset.Update

    The Delete is the Easiest ie

    rsRecset.Open "Delete from table where pin = '" & Trim(strReceivedMessage) & "'", conGais, adOpenDynamic, adLockOptimistic

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    aha.. thanks for that code.. and last favor sir can you attach it in zip...

    thanks and advanced

    br

  17. #17
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: I Need some advice and help

    Thats it hope you'll get the hang of it good luck
    Attached Files Attached Files

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2002
    Location
    Philippines
    Posts
    877

    Re: I Need some advice and help

    Thank you so much for your help.

    Best Regards,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width