使用VB从MS Access 97检索记录 [英] Retrieving Records from MS Access 97 using VB

查看:127
本文介绍了使用VB从MS Access 97检索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我想存储和检索来自Access 97和vb6.0的记录
为了存储记录,我编写了以下代码:

Hello

I want to store and retrieve records from Access 97 and vb6.0
to store records, I wrote a the following Code:

Dim MyConn As ADODB.connection

       Set MyConn = New ADODB.connection
       Dim MyRecSet1 As New ADODB.Recordset

       MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
       MyConn.Open
        MyConn.Execute ("INSERT INTO table1 VALUES(''" + Text1.Text + "'',''" + Text2.Text + "'',''" + Text3.Text + "'')")


   MsgBox "The record was added to database", vbInformation, "Succesfull adding"
   MyConn.Close



我有两个问题
1.如何使用参数化查询以相同的方式检索那些记录,
并将其存储在文本框中.

2.还有其他使用
插入和检索的方法 Microsoft.Jet.OLEDB.4.0;



I have two Questions
1. How to retrive those records using parametarized Query in the same way,
and store it in text boxes.

2. Is there any other way to insert and retrieve, using
Microsoft.Jet.OLEDB.4.0;

推荐答案

您使用MyConn .CreateParamenter .

如何使用VBA调用参数化ADO查询 [使用ADO和存储过程 [
You use MyConn.CreateParamenter.

How To Invoke a Parameterized ADO Query Using VBA[^] and Using ADO and stored procedures[^]


这篇关于使用VB从MS Access 97检索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆