请问有什么控件与数据库相连,做成编辑框的形式,可以进行编辑。好像在文本框里进行编辑一样。用textbox可以吗?请问与数据库怎样连接?datasource等属性怎样设置?
谢谢

解决方案 »

  1.   

    用DataGrid和Adodc.dim strconn as string
    '連接代碼
      strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\test.mdb;Persist Security Info=False"
      Adodc1.ConnectionString = strconn
      Adodc1.CommandType = adCmdUnknown
      Adodc1.RecordSource = "select 姓名 from test where ID=" & intID & ""
      Set DataGrid2.DataSource = Adodc1
      If Adodc1.Recordset.RecordCount = 0 Then
         Adodc1.Recordset.AddNew
         Adodc1.Recordset("姓名") = ""
      End If
      

  2.   

    你可以用data(adodc)控件连接datagrid(dbgrid\mshflexgrid)这样都可以编辑啊
      

  3.   

    我用datagrid和adodc已经实现了。我想创建动态连接库,在编辑框里进行修改。好像textbox(不是最常用的那个)有这个功能,但具体的datasource 和datafield怎样设置,进行编辑?
      

  4.   

    data 与 dbgrid
    adodc 与 datagrid
      

  5.   

    如果用的是data控件:在属性窗里选text1.datasource="data1"在text1.datafield="你访问表中的属性"
    如果用的是ADO对象操作数据库你要设置一个记录集:dim rs new adodb.recordset,联接我就职不写,然后你就可以:set text1.datasource = rs,text1.datafield = "你访问表中的属性"