插入删除和更新 [英] INSER DELETE AND UPDATE

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

问题描述

大家好吧


我有2个问题,没有人可以帮助我,请帮助我


第一个问题:我想从Access数据库中删除一条记录,该记录的记录为"ID_Per"字段,该字段类型为Number,我编写此代码:

代码:

Hi everybuddy


i have 2 problem , and nobody can help me , please help me


First Problem : I want Delete a Record From Access Data base with its Record "ID_Per" Field , That Field Type is Number , i Write this Code :

Code:

com.commandtext = "Delete * From Personels Where ID_PER = '"& txt_ID_per.text &"' "
com.ExecuteNonQuery()



错误msg:CIRITIA中的数据类型不匹配


-当我将该字段类型更改为文本时,此问题可以,但是我需要数字类型,请帮帮我!


'''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''
第二个问题:
我有:



ERROR msg : DATA TYPE MISMATCH IN CIRITIA


- When i change that field type to text this problem is OK , but i need Number Type , Please help me!


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Second Problem :
i have :

Dim tt as byte()




tt在自己中保存了图片位,我想将其发送到Access数据库,我可以使用以下代码进行操作:


代码:




tt saved a picture bits in yourself , i want send it to data base Access , i can do it with this code :


code:

com.commandtext = "Insert into KK VALUES(@pic_bit)"
com.parameters.AddWithValue("pic_bit" , tt)
com.ExecuteNonQuery()



但我想用这种方式发送:


代码:



But i want Send with this Way :


Code:

com.commandtext = "Insert into KK (pic_bit) VALUES ('"& tt &"')"
com.ExecuteNonQuery()




我做不到,我看到了SOme错误,请说出这段代码是什么错误或说我如何使用DATA COMMAND参数更新和删除方式


非常感谢


Pleeeeeease回复




i cant Do it , i see SOme Errors , Please Say me whats this code Error OR say me How can i UPDATE and Delete with DATA COMMAND PARAMETERS Way


Thank you Very much


Pleeeeeease Reply

推荐答案

1)删除数字类型的单引号
com.commandtext = "Delete * From Personels Where ID_PER = "& txt_ID_per.text

2)不能.
1) Remove single quote for numeric type
com.commandtext = "Delete * From Personels Where ID_PER = "& txt_ID_per.text

2) You can''t.


问题1
将类型保留为数字在Access数据库和

试试这个
For problem 1
Keep the type as number in access database and

try this
com.commandtext = "Delete * From Personels Where ID_PER = "& Convert.ToInt32(txt_ID_per.text) ;
com.ExecuteNonQuery()


这篇关于插入删除和更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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