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
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..
'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.
You need to open your recordset for update ie rsRecset.Open "Select * from table where pin = '" & Trim(strReceivedMessage) & "'", conGais, adOpenDynamic, adLockOptimistic