problem in editing and deleting

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
in my form,i have one of my column is "id" .
in the back end i created one table ,in which i declared id as varchar(because i want to accept id as number say 111 or a varchar say 111/05.

now from vb.net ,i am giving id as input and i am trying to retrieve all the corresponding fields.
if i give id as 111,then the corresponding fields are getting edited,deleted and updated.

if i give number as 111/05(here /05 is the year),then it is storing in the back end but ,while editing it is displaying that "No ID Exists".
and while deleting it is showing error as "Syntax error converting the varchar value '11/05' to a column of data type int".
any suggestions .
thks
 
Somewhere you have your column declared as being of data type int. From what you've said, it is not in the database itself. Somewhere, something thinks that your column is an int. Are you using a CommandBuilder to perform the updates?
 
no i didnt use any int datatype.

in the back end i declared id as varchar.
by the i am updating by using "UPDATE " statement.

i checked all through but ,i coudlnt find the error.
can i know what r the other possiblities for solving this problem.
jmcilhinney said:
Somewhere you have your column declared as being of data type int. From what you've said, it is not in the database itself. Somewhere, something thinks that your column is an int. Are you using a CommandBuilder to perform the updates?
 
retrieve problems

i am unable to find the error.

and one more error is
when i enter any number say 8899 ,then that no. is stored ,retrieved ,updated and deleted.
but next time when i enter 99/05 ,this number is stored but not retrieved ,edited or deleted.

for the third time again if i want to edit 8899 ,then that no.is not edited, unless and until i remove the 99/05 row from the back end.

now what to do
any suggestions
pls
jmcilhinney said:
If you are using them, are you sure you have your parameters set correctly?
 
If you are placing the values directly into your SQL statement, are you sure you are putting quotes around the values? I think it might be possible that 99/05 is being interpreted as 99 divided by 5 and therefore 19.8 is the actual value being stored, either as a number or as text. Are you actually looking at the contents of the table after a row is inserted? Try using a word instead of a number. If something in your code is looking for a number then it should fail at that point with a word provided instead. That should then tell you where the issue is.
 
after inserting in the database,i checked for that particular row.

if i insert 99/05 ,then it is storing as 99/05 only,but not 99 / 5 ie 19.8.

Inserting no problem,but if i want to retrieve then it is showing error as " no number exists".


jmcilhinney said:
If you are placing the values directly into your SQL statement, are you sure you are putting quotes around the values? I think it might be possible that 99/05 is being interpreted as 99 divided by 5 and therefore 19.8 is the actual value being stored, either as a number or as text. Are you actually looking at the contents of the table after a row is inserted? Try using a word instead of a number. If something in your code is looking for a number then it should fail at that point with a word provided instead. That should then tell you where the issue is.
 
got the ans. to my query

The silly mistake i did was while passing textboxvalue in a parameter , ididnt put single quotes.

i gave the query as "select * from tablename where columnname=' " & textbox1.text & " '
then my problem is solved.

thks for ur quick responses.
srivalli said:
after inserting in the database,i checked for that particular row.

if i insert 99/05 ,then it is storing as 99/05 only,but not 99 / 5 ie 19.8.

Inserting no problem,but if i want to retrieve then it is showing error as " no number exists".
 
provider for msexcel

hiii,
i am using msexcel as backend in vb.net
can u help me what is the provider we have to use for excel
its a bit urgent.
thank u
jmcilhinney said:
As I suggested at the beginning of post #7.
 
srivalli said:
hiii,
i am using msexcel as backend in vb.net
can u help me what is the provider we have to use for excel
its a bit urgent.
thank u
You probably should have started a new thread for this new question.

You use the same provider as you use for Access, which is Microsoft Jet 4.0. The difference is in the SQL statements you use. Check this page for info on how to access Office data, including Excel, using ADO.NET.
 
Back
Top