473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Update value in database where value in textbox is equal to specific field in table.

How can i update the values in a table in database.The condition to update is a value in a textbox.
I hav a textbox containing the order value.The table order_detail should be updated for its some values like shipment date,transporter name etc where order no is equql to the value in the textbox(containg order no).?
plz suggest me some ways....thanks for your help.
Jul 15 '08 #1
7 2882
jhaxo
57
Try this link for how the sql update statement works. It might be what you are looking for.

http://www.w3schools.com/Sql/sql_update.asp
Jul 15 '08 #2
Curtis Rutland
3,256 Expert 2GB
Look in the "how to" section for the articles on how to use a db in your .net program part 1&2. sorry no link, posting from my phone.
Jul 15 '08 #3
Curtis Rutland
3,256 Expert 2GB
Links:
How to Use A Database In Your .NET Program
How to Use A Database In Your .NET Program Part II

This should tell you what you need to know to use databases in your programs.
Jul 16 '08 #4
thanks for ur answers.
i know the connection and sql query details.But my problem is that when i am
giving specific values in where clause and the set clause it is working,but when i m
writing like....
update emp set emp_name=textBox1.Text where roll_no=textBox2.Text;

error ic coming-MULTI-PART IDENTIFIER 'textBox2.text' CAN NOT BE BOUND.
SO THE PROBLEM IS THAT IT IS NOT TAKING THE VALUES IN TEXTBOX,IT IS ONLY USING THE SPECIFIC VALUES.


This statement is working
update emp set emp_name='neha' where roll_no=2;

plzzzzzzz reply if u know the ans.
Jul 16 '08 #5
Curtis Rutland
3,256 Expert 2GB
Ok. Your original question was misleading. Here's a code sample that will show you how do do a parameterized query. This way, you just plug in parameters, and then define those parameters later and give them values.

Expand|Select|Wrap|Line Numbers
  1. string update = "update test set fName=@fName where id=@id";
  2. OleDbCommand cmd = new OleDbCommand(update, conn);
  3. cmd.Parameters.AddWithValue("@fName", TextBox1.Text);
  4. cmd.Parameters.AddWithValue("@id", Convert.ToInt32(TextBox2.Text));
  5.  
Jul 16 '08 #6
thanks for help.this code is working.
Jul 17 '08 #7
Curtis Rutland
3,256 Expert 2GB
Happy to have helped.
Jul 17 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Gompie | last post by:
Why does the function DMin("Abs(!- #" & & "#)";"SomeTable") not work properly with datefields. It always finds the closest difference with a later date only, if an earlier date in the table is...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
4
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.