我先定义了mystring为连接字符串,myselectquery为查询字符串
Dim myconnection As New Sqlconnection(mystring)
dim myadapter as new sqldataadapter()
myadapter.SelectCommand = New SqlClient.SqlCommand(myselectquery, myconnection)
这样以后,我想定义一个dim abc as dataset
然后想把查询结果写入dataset这个数据集
然后显示所查询的表,显示在datagrid1里面,各位大侠,帮忙写出代码。
如果方便,再写一下,如果我在datagrid1里修改了数据以后,应如何更新数据库。
先谢谢了,满分求助
你是用VB吧,到VB去问一下吧,相信你很快会有答案的。:)
到管理里去删除呀
例:
dim ac_tmp as new adodb.connection
dim ar_tmp as new adodb.recordset
with ac_tmp
...
...
end with
txtSQL = "select 名称 from 学生表 where 号码="& combobox.text &""
with ar_tmp
if .state=adstateopen then .close
.open txtSQL,ac_tmp,adopenkeyset,adlockreadonly
end with
if ar_tmp.recordcount>0 then
text.text=ar_tmp!名称
else
text.text=""
endif
ar_tmp.close