Click here to Skip to main content
15,910,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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


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 :
VB
Dim tt as byte()



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


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


But i want Send with this Way :


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



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
Posted
Updated 10-Nov-11 0:55am
v2

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

2) You can't.
 
Share this answer
 
For problem 1
Keep the type as number in access database and

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900