473,471 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Displaying data from database in textboxes.

Hello,

I have form where I want to display data from one record. So I created
stored procedure with parameter and I populated some dropdown boxes
with data, and now I would like to display that record in the
textboxes and combo boxes.
So I have data conection, data adapter and query with parameter.
How do I bind this to textboxes and dropdown boxes.
textbox.text = ?? I guess what I cannot find is how to point to
specific field in the dataset.
Below is piece of code that I am using for dataadapter and dataset:

conn.Open()

Dim daCategory As New SqlDataAdapter("sp_task", conn)
daCategory.SelectCommand.CommandType =
CommandType.StoredProcedure

Dim IDtask As New SqlParameter("@IDTask",
System.Data.SqlDbType.NVarChar)
IDtask.Direction = ParameterDirection.Input
IDtask.Value = Request.QueryString("IDTAsk")
daCategory.SelectCommand.Parameters.Add(IDtask)

Dim dsZadanie As New DataSet
daCategory.Fill(dsTask, "Task")

Thank's
Arek
Nov 18 '05 #1
3 13400
If you are only returning one value from a query, its best to use the
DataReader.
So, say you stored proc returns a single valu, you can use the datareader as
follows:

Dim ObjCmd as New OleDbCommand("sp_task", conn)
ObjCmd.CommandType = CommandType.StoredProcedure
Dim IDtask As New SqlParameter("@IDTask",
System.Data.SqlDbType.NVarChar)
IDtask.Direction = ParameterDirection.Input
IDtask.Value = Request.QueryString("IDTAsk")
ObjCmd.Paramters.Add(IDtask)

conn.Open()
Dim dr as OleDbDataReader = ObjCmd.ExecuteReader()
if dr.Read() then
textbox.text = Convert.ToString(dr[0])
end if
connClose()


"Schapopa" <ar**********@hotmail.com> wrote in message
news:f3**************************@posting.google.c om...
Hello,

I have form where I want to display data from one record. So I created
stored procedure with parameter and I populated some dropdown boxes
with data, and now I would like to display that record in the
textboxes and combo boxes.
So I have data conection, data adapter and query with parameter.
How do I bind this to textboxes and dropdown boxes.
textbox.text = ?? I guess what I cannot find is how to point to
specific field in the dataset.
Below is piece of code that I am using for dataadapter and dataset:

conn.Open()

Dim daCategory As New SqlDataAdapter("sp_task", conn)
daCategory.SelectCommand.CommandType =
CommandType.StoredProcedure

Dim IDtask As New SqlParameter("@IDTask",
System.Data.SqlDbType.NVarChar)
IDtask.Direction = ParameterDirection.Input
IDtask.Value = Request.QueryString("IDTAsk")
daCategory.SelectCommand.Parameters.Add(IDtask)

Dim dsZadanie As New DataSet
daCategory.Fill(dsTask, "Task")

Thank's
Arek

Nov 18 '05 #2
ExecuteScalar would be even faster.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"GrantMagic" <gr***@magicalia.com> wrote in message
news:OL**************@TK2MSFTNGP15.phx.gbl...
If you are only returning one value from a query, its best to use the
DataReader.
So, say you stored proc returns a single valu, you can use the datareader
as follows:

Dim ObjCmd as New OleDbCommand("sp_task", conn)
ObjCmd.CommandType = CommandType.StoredProcedure
Dim IDtask As New SqlParameter("@IDTask",
System.Data.SqlDbType.NVarChar)
IDtask.Direction = ParameterDirection.Input
IDtask.Value = Request.QueryString("IDTAsk")
ObjCmd.Paramters.Add(IDtask)

conn.Open()
Dim dr as OleDbDataReader = ObjCmd.ExecuteReader()
if dr.Read() then
textbox.text = Convert.ToString(dr[0])
end if
connClose()


"Schapopa" <ar**********@hotmail.com> wrote in message
news:f3**************************@posting.google.c om...
Hello,

I have form where I want to display data from one record. So I created
stored procedure with parameter and I populated some dropdown boxes
with data, and now I would like to display that record in the
textboxes and combo boxes.
So I have data conection, data adapter and query with parameter.
How do I bind this to textboxes and dropdown boxes.
textbox.text = ?? I guess what I cannot find is how to point to
specific field in the dataset.
Below is piece of code that I am using for dataadapter and dataset:

conn.Open()

Dim daCategory As New SqlDataAdapter("sp_task", conn)
daCategory.SelectCommand.CommandType =
CommandType.StoredProcedure

Dim IDtask As New SqlParameter("@IDTask",
System.Data.SqlDbType.NVarChar)
IDtask.Direction = ParameterDirection.Input
IDtask.Value = Request.QueryString("IDTAsk")
daCategory.SelectCommand.Parameters.Add(IDtask)

Dim dsZadanie As New DataSet
daCategory.Fill(dsTask, "Task")

Thank's
Arek


Nov 18 '05 #3
Thank you for your help,
So I am using datareader and it works very good.
I started to use dataset but really there is no need for that.
Regards
Arek


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
12
by: Mike | last post by:
I'm calling a component to get my data. The component is returning a dataset. I need to populate text boxes on my aspx page with the data within the datalist. Where can I find an example that...
5
by: \A_Michigan_User\ | last post by:
I'm using asp.net/vb.net/ado.net to create a very simple user interface. (Everything works if I use STATICALLY created textBoxes... but not when I make them DYNAMICALLY.) 1. Execute a SQL...
2
by: p.mc | last post by:
Hi all, I'm using asp.net to display data from a SQL Server database, I've managed to display the data using dataGrids but now need to have more control over the display of the data. I'd like...
13
by: David W. Fenton | last post by:
I've been struggling the last two days with something I thought was very easy, which is to open a web page with a form on it and populate the form with data passed in a query string (either POST or...
1
by: seadog | last post by:
Hi, I am having a problem displaying data in a textbox array. What I am trying to do is have 5 number enter 5 textboxes, starting from the first and working there way to the bottom textbox. What...
1
by: srinuvasteegala | last post by:
i wrote a javascript for displaying textboxes when i enter a number in a texbox. now i want to insert some data in those textboxes and save the data in backend and display the same in a grid
2
by: sweatha | last post by:
Hi I have to display the data from SQL Server table to the frontend textboxes during the page load. For that I have given the coding as, Imports System.Data Imports System.Data.SqlClient...
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
marktang
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,...
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...
0
tracyyun
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...
0
agi2029
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.