i hav a form. there is a roll.no textbox,i want that when i enter a roll no. ,that rollno if exist in a table in the database then it bring its corresponding values like name,add,etc to the textbox in the same form.
hope my query is clear.
plz reply as soon as possible.thanks ......
11 3104
Do you know how to connect to a database using ADO.NET?
Do you know how to connect to a database using ADO.NET?
yes i know the connectivity steps.i am using sqlserver.my query is how to get the data from database to the textbox in a form.i know how to display the data from database to gridveiw but i dont know how to display it into textbox from database.
i hav a form. there is a roll.no textbox,i want that when i enter a roll no. ,that rollno if exist in a table in the database then it bring its corresponding values like name,add,etc to the textbox in the same form.
hope my query is clear.
plz reply as soon as possible.thanks ......
Then just write a select that filters according to the entered rollno and run that against the database when an appropriate event is fired.
Post your code if you still get problems with it.
...i know how to display the data from database to gridveiw but i dont know how to display it into textbox from database.
Well, we have two articles that you might want to read. After that, you should be able to figure out how to fill a textbox from a database. Article 1 Article 2
Well, we have two articles that you might want to read. After that, you should be able to figure out how to fill a textbox from a database. Article 1 Article 2
thanks for the articles.The matter u hav given me,i already know that,what i want to know is described below.
i m using C# .net and working on window forms.
my code is-
SqlConnection cn = new SqlConnection() ;
cn.ConnectionSt ring = "Data Source= abc ;Database=def ;uid=ghh ;pwd=ty ";
cn.Open();
string sql="select * from order where order_no=@order ";
SqlCommand cmd=new SqlCommand(sql, cn);
cmd.Parameters. AddWithValue("@ order",Convert. ToInt32(textBox 1.Text);
SqlDataAdapter da=new SqlDataAdapter( cmd);
da.Fill(dt); /*dt is a instance of DataTable*/
dataGridView1.D ataSource=dt;
cn.Close();
............... ............... ............... ............... ............... ...........
i want to show the values in textbox respectively.
i know how to show the data in gridview but i want to know how can i get the data in textBox not in dataGridview.
So, instead of making the DataTable a datasource for the gridview, loop through it and put the contents in a textbox. Or, if you are just selecting one value, you can use the ExecuteScalar method that I discuss in the 2nd article. Just cast the return value as a string, and then put that string in a textbox. You're making this harder than it has to be.
So, instead of making the DataTable a datasource for the gridview, loop through it and put the contents in a textbox. Or, if you are just selecting one value, you can use the ExecuteScalar method that I discuss in the 2nd article. Just cast the return value as a string, and then put that string in a textbox. You're making this harder than it has to be.
thanks i got it,i will try it.
thanks i got it,i will try it.
thank u ,its working.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: chris |
last post by:
I have a question which I hope will have an easy answer. I created a webform with one textbox and a button. The button creates a connection to sqlserver, a data adapter, a dataset and querys the databse for a single returned value. All this works fine. Now how do I bind the returned value to the textbox on my form?
regards
|
by: thomson |
last post by:
Hi All,
i do have an application that searches the databse, For eg, i
do,
SqlHelper.ExecuteReader("","") this is the point where i call the
stored procedure to fetch the data from the database, sometimes it
takes me a lot of time to gimme the result, i need to show the user
something is happening while it fetches the data from the...
|
by: saeedeh |
last post by:
hi to all
i have some problem with fetching my form enteries. the problem is when i post some enteries through a form to a databse called 'applicant' and try to fetch and print it nothing appears.it seems that nothing has passed to the databse. but i think i`ve written the code correctly.can you please tell me what you think about my...
|
by: dj12345 |
last post by:
Hi,
(Asp.net + Ajax)
I am creating a page which will fetch data from server without postbak of a page..
I have 2 controls on this page TextBox and Lable. I have assigned TextBoxWatermark extender to TextBox. Inside a Update panel i have Lable.. and the update panel refreshes each 3 seconds and it fetches data and displays it. But my...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |