我用的是MSFLEXGRID,应该差不多的,你看下Private Sub Grid1_Click() '确定按钮的第二个条件满足 Fflag = True 'MsgBox Fflag Call Cshct Call Lock_txt Grid1.Col = 3 hang = Grid1.Row 'MsgBox hang Adodc2.RecordSource = "select * from main where bh='" & Trim(Grid1.Text) & "'" Adodc2.Refresh With Adodc2 txt_bh.Text = .Recordset("bh") Combo1.Text = .Recordset("lb") txt_name.Text = .Recordset("name") txt_jg.Text = .Recordset("jg") txt_grrq.Text = .Recordset("grrq") txt_rkrq.Text = .Recordset("rkrq") If Not IsNull(.Recordset("jcrq").Value) Then txt_jcrq.Text = .Recordset("jcrq") End If If Trim(.Recordset("country")) = "0" Then txt_gj.Text = "" Else txt_gj.Text = .Recordset("country") End If If Trim(.Recordset("zz")) = "0" Then txt_zz.Text = "" Else txt_zz.Text = .Recordset("zz") End If If Trim(.Recordset("cbs")) = "0" Then txt_cbs.Text = "" Else txt_cbs.Text = .Recordset("cbs") End If If .Recordset("jj") <> "0" Then textbox_jj.Text = .Recordset("jj") End If If .Recordset("zzjj") <> "0" Then textbox_zzjj.Text = .Recordset("zzjj") End If If Trim(.Recordset("picture")) <> "0" Then Picture1.Picture = LoadPicture(Trim(.Recordset("picture"))) End If End WithEnd Sub
我现在用的是datagrid控件,现在基本上正常,但是我用了一个查询的语句,把查询出来的结果单击显示在一个textbox上,然后可以修改, rst.Open "select * from xinwen where title like '%" & Trim(Text1.Text) & "%'", cn, adOpenKeyset, adLockBatchOptimistic 但是却提示我实时错误7010 此列只读?这是怎么回事?
adodc1.recordset.fields(1)=text1.text
.....
adodc1.recordset.update
Adodc1.Recordset.Fields("keyword") = txtkeyword.Text
Adodc1.Recordset.Fields("title") = txttitle.Text
Adodc1.Recordset.Fields("content") = txtcontent.Text
Adodc1.Recordset.Fields("number") = txtnumber.Text
Adodc1.Recordset.Update
还是不行呀?
总是自动覆盖当前记录
adodc1.refresh即可
我的窗体有4个textbox,我在第一个textbox输入数据后,然后在把光标焦点放到第二个textbox,
这时候第一个textbox的内容就自动消失?然后点第3个,第二个也消失?
这种情况发生在数据库中一条数据也没有的情况下,可是只要数据库中有一条数据,就不会发生这种情况?
请问这是怎么回事?
怎么查询datagrid的数据?
分不够我还可以再加,请大家多帮忙了
'确定按钮的第二个条件满足
Fflag = True
'MsgBox Fflag
Call Cshct
Call Lock_txt
Grid1.Col = 3
hang = Grid1.Row
'MsgBox hang
Adodc2.RecordSource = "select * from main where bh='" & Trim(Grid1.Text) & "'"
Adodc2.Refresh
With Adodc2
txt_bh.Text = .Recordset("bh")
Combo1.Text = .Recordset("lb")
txt_name.Text = .Recordset("name")
txt_jg.Text = .Recordset("jg")
txt_grrq.Text = .Recordset("grrq")
txt_rkrq.Text = .Recordset("rkrq")
If Not IsNull(.Recordset("jcrq").Value) Then
txt_jcrq.Text = .Recordset("jcrq")
End If
If Trim(.Recordset("country")) = "0" Then
txt_gj.Text = ""
Else
txt_gj.Text = .Recordset("country")
End If
If Trim(.Recordset("zz")) = "0" Then
txt_zz.Text = ""
Else
txt_zz.Text = .Recordset("zz")
End If
If Trim(.Recordset("cbs")) = "0" Then
txt_cbs.Text = ""
Else
txt_cbs.Text = .Recordset("cbs")
End If
If .Recordset("jj") <> "0" Then
textbox_jj.Text = .Recordset("jj")
End If
If .Recordset("zzjj") <> "0" Then
textbox_zzjj.Text = .Recordset("zzjj")
End If
If Trim(.Recordset("picture")) <> "0" Then
Picture1.Picture = LoadPicture(Trim(.Recordset("picture")))
End If
End WithEnd Sub
rst.Open "select * from xinwen where title like '%" & Trim(Text1.Text) & "%'", cn, adOpenKeyset, adLockBatchOptimistic
但是却提示我实时错误7010 此列只读?这是怎么回事?