DIM STRINP AS STRINGDIM MSGINT AS INTEGERDIM INTLEN AS INTEGENT AS INTEGERDIM INTLEN AS INTEGERSTRINP = INPUTBOX ("Please enter the IMEI of you want to query", "Introduction Record Inquiry") Intlen = LEN (STRINP) IF STRINP = "" "" "" "" "" "" "" "" "" "" Empty IMEI is also queried! Please re-enter the IMEI ", vbokonly," speech ") exit suend correspondodc1.connectionstring =" provike = microsoft.jet.oledb.4.0; data source = "& app.path &" /apkf.mdb;Persist Security Info = False "Adodc1.CommandType = adCmdTextAdodc1.RecordSource =" select * from [apkf] where right (imei, "& intlen &") = ' "& strinp &"' "Adodc1.Refresh
reference:
Private Sub Adodc1_MoveComplete (ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Text1.Text = Adodc1.Recordset.Fields ( "name") End Sub
Private sub DataGrid1_click () text1.text = adodc1.recordset.fields ("name") End Sub
Private Sub Form_Load () Adodc1.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C: / Program Files / Microsoft Visual Studio / VB98 / BIBLIO.MDB; Persist Security Info = False" Adodc1.CommandType = adCmdTextAdodc1 .Recordsource = "SELECT * from Publishers" adodc1.refreshset DataGrid1.datasource = AdodC1END SUB