使用DATA COMMAND参数更新 [英] UPDATE with DATA COMMAND Parameters

查看:87
本文介绍了使用DATA COMMAND参数更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个好友

我可以像这样插入参数:


Hi Every Buddy

I Can insert with parameters Like this :


Com.Commandtext = "Insert Into Personels VALUES(@ID_Per)"
Com.Parameters.AddWithValue("ID_per" , Txt_ID_per.text)
com.ExecuteNonQuery()



我该如何在UPDATE中进行操作?



How Can i DO it in UPDATE ?

推荐答案

完全相同的方式

Exactly the same way

Com.Commandtext = "UPDATE Personels SET field1 = @field1 WHERE ID_per = @ID_per"
Com.Parameters.AddWithValue("ID_per" , Txt_ID_per.text)
Com.Parameters.AddWithValue("field1" , field1Value)
com.ExecuteNonQuery()



希望对您有所帮助



Hope this helps


Com.Commandtext = "update Personels set fieldname = " & @x & " where ID_Per = " & @ID_Per



其中fieldname是您需要更新的列名,x是要输入的值,ID_Per是您需要修改的记录的ID

如果x是数字,请使用& cstr(@x)&"



where fieldname is the column name you need to update, x is the value to enter and ID_Per is the ID of the record you need to modify

if x is numeric use " & cstr(@x) & "


这篇关于使用DATA COMMAND参数更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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