₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,327,234 members, 8,429,960 topics. Date: Friday, 19 June 2026 at 04:47 PM

Toggle theme

Vb.net Update Error - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingVb.net Update Error (1239 Views)

1 Reply (Go Down)

Vb.net Update Error by bigafees(op): 12:50pm On Nov 09, 2010
Please assist me with this code it given me error

mystring = "update Admission SET Disch_date= " & TextBoxdischdate.Text & " ,disch_time = " & TextBoxdischtime.Text & " ,Days_spent = " & TextBoxdays.Text & " ,Disch_Status= " & textboxstatus.Text & " where medical_Id = " & TextBoxid.Text & " and Adm_date =" & Date.Parse(TextBoxadmdate.Text) & ""


mycmd.CommandText = mystring
mycon.Open()
mycmd.ExecuteNonQuery()
mycon.Close()


it complain at mycmd.ExecuteNonQuery()
Re: Vb.net Update Error by TBits: 1:15pm On Nov 09, 2010
if the underlying database columns are varchar and datetime, then you are to send the values to the database enclosed in single quotes which you are not doing e.g ' " & texbox1.text & " ' "
Re: Vb.net Update Error by Nobody: 2:07pm On Nov 09, 2010
you should enclose all your controls in single qoute as in '" & name=text1.text & "'
Re: Vb.net Update Error by Kobojunkie: 5:53pm On Nov 10, 2010
@Poster, first problem I see . . .  .You do not inform us exactly of what the compiler complaints were.

Secondly, you ought to be using parameterized queries by now. Even better, try to avoid inline SQL wherever you can instead. What you have up there is recipe for SQL Injection grin

Anyways, do post the actual error message and we can better help.
Re: Vb.net Update Error by dazz4me: 8:43am On Nov 11, 2010
So many things is wrong with your query. First i think its easier and better to use parameterised query.
And use single quote for your values
Re: Vb.net Update Error by bigafees(op): 10:18am On Nov 11, 2010
Thanx, I have solved the problem with your posts

I have problem with this also, i have google it but no suitable solution

command.CommandText = "Select count(*) as nob from Admission where medical_id='" & txtmedid.Text & "' and disch_date IS NULL"
connection.Open()
command.ExecuteScalar()
If ("nob"wink > 1 Then

Label1.Text = "The Patient is currently on Admission, Discharge First "
Else


it complaining at If ("nob"wink > 1 Then pls assit me house, i'm teaching myself on vb.net
Re: Vb.net Update Error by TBits: 4:04pm On Nov 11, 2010
you cannot test the column name you are retrieving (nob) rather you should be testin the value the column retrieves try the following below

command.CommandText = "Select count(*) as nob from Admission where medical_id='" & txtmedid.Text & "' and disch_date IS NULL"
connection.Open()

dim value as long
value = Convert.ToInt32(cmd.ExecuteScalar())
if value > 1
Label1.Text = "The Patient is currently on Admission, Discharge First "
Else
1 Reply

I Need A Help To Write A Simple Login Form Using Vb.netVb.net Crystal Report & DatasetPost Ur Vb 6.0 Questions Here234

Any One With Programming Skill In C,c++, Or Assembly LanguageCan Somebody Explain What This Means & where should it be used ??Automatic Speech Recognition (ASR) For Yorùbá Language.