473,327 Members | 2,103 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,327 software developers and data experts.

displaying Accessdatasource field in textbox using ASP.Net and VS.Net 2005 ?

How can I display any field value in textbox of sqldatasource using VS.Net
2005 ?

Say : Dim x as new AccessDataSource
X.connectionstring="Data source="D:\mydb.mdb"
X.Selectcommand="Select CompanyName from customers"

Textbox1.text= ??? <-------- I need to display CompanyName Field in this
textbox, how can I ?

Best Regards,

Luqman

Jan 20 '06 #1
4 3554
How many values do you want to put into your TextBox? Your SQL select
statement will probably return back more than one value.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I display any field value in textbox of sqldatasource using VS.Net
2005 ?

Say : Dim x as new AccessDataSource
X.connectionstring="Data source="D:\mydb.mdb"
X.Selectcommand="Select CompanyName from customers"

Textbox1.text= ??? <-------- I need to display CompanyName Field in
this
textbox, how can I ?

Best Regards,

Luqman


Jan 23 '06 #2
Hi,

I want to display each field in a separate textbox, so if I have 2 fields,
say, companycode and companyname, I want to display both of them in two
textboxes.

For eg.

Textbox1.text= companycode
Textbox2.text=companyname

But I don't know the syntax, Any idea please ?

Best Regards,

Luqman

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:uy*************@TK2MSFTNGP11.phx.gbl...
How many values do you want to put into your TextBox? Your SQL select
statement will probably return back more than one value.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I display any field value in textbox of sqldatasource using
VS.Net
2005 ?

Say : Dim x as new AccessDataSource
X.connectionstring="Data source="D:\mydb.mdb"
X.Selectcommand="Select CompanyName from customers"

Textbox1.text= ??? <-------- I need to display CompanyName Field in
this
textbox, how can I ?

Best Regards,

Luqman



Jan 24 '06 #3
You might consider using a FormView which is a template-based data control.
So, within your ASPX page, you could do something like this:

<asp:FormView id="FormView1" runat="server"
DataSourceID="AccessDataSource1">
<ItemTemplate>
<asp:TextBox id="TextBox1" runat="server" Text='<%#
Eval("CompanyCode") %>' />
<asp:TextBox id="TextBox2" runat="server" Text='<%#
Eval("CompanyName") %>' />
</ItemTemplate>
</asp:FormView>
<asp:AccessDataSource id="AccessDataSource" runat="server"
ConnectionString = "Data source=D:\mydb.mdb"
SelectCommand = "Select CompanyCode, CompanyName from customers" />

Depending your actual set up, you may have to tweak the above a little.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I want to display each field in a separate textbox, so if I have 2 fields,
say, companycode and companyname, I want to display both of them in two
textboxes.

For eg.

Textbox1.text= companycode
Textbox2.text=companyname

But I don't know the syntax, Any idea please ?

Best Regards,

Luqman

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:uy*************@TK2MSFTNGP11.phx.gbl...
How many values do you want to put into your TextBox? Your SQL select
statement will probably return back more than one value.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I display any field value in textbox of sqldatasource using
VS.Net
2005 ?

Say : Dim x as new AccessDataSource
X.connectionstring="Data source="D:\mydb.mdb"
X.Selectcommand="Select CompanyName from customers"

Textbox1.text= ??? <-------- I need to display CompanyName Field in
this
textbox, how can I ?

Best Regards,

Luqman




Jan 24 '06 #4
Ok thanks for your help, I will definitely try out.

Best Regards,

Luqman

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
You might consider using a FormView which is a template-based data
control. So, within your ASPX page, you could do something like this:

<asp:FormView id="FormView1" runat="server"
DataSourceID="AccessDataSource1">
<ItemTemplate>
<asp:TextBox id="TextBox1" runat="server" Text='<%#
Eval("CompanyCode") %>' />
<asp:TextBox id="TextBox2" runat="server" Text='<%#
Eval("CompanyName") %>' />
</ItemTemplate>
</asp:FormView>
<asp:AccessDataSource id="AccessDataSource" runat="server"
ConnectionString = "Data source=D:\mydb.mdb"
SelectCommand = "Select CompanyCode, CompanyName from customers" />

Depending your actual set up, you may have to tweak the above a little.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I want to display each field in a separate textbox, so if I have 2
fields, say, companycode and companyname, I want to display both of them
in two textboxes.

For eg.

Textbox1.text= companycode
Textbox2.text=companyname

But I don't know the syntax, Any idea please ?

Best Regards,

Luqman

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:uy*************@TK2MSFTNGP11.phx.gbl...
How many values do you want to put into your TextBox? Your SQL select
statement will probably return back more than one value.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Luqman" <pe*******@cyber.net.pk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can I display any field value in textbox of sqldatasource using
VS.Net
2005 ?

Say : Dim x as new AccessDataSource
X.connectionstring="Data source="D:\mydb.mdb"
X.Selectcommand="Select CompanyName from customers"

Textbox1.text= ??? <-------- I need to display CompanyName Field in
this
textbox, how can I ?

Best Regards,

Luqman




Jan 25 '06 #5

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

Similar topics

5
by: nbohana | last post by:
I have a windows form with several fields. One of the fields is a date. I use DateTimePicker to enter and format the date. In my SQL table the date si stored as follows "01/10/2005" and this is...
2
by: aabid | last post by:
I started using VWD 2.0 Express Edition. I am new to web applications. Can somebody post a sample code to show how to retrieve data from an SQL 2005 table and display in a textbox or label?. I am...
0
by: Luqman | last post by:
How can I display any field value in textbox of sqldatasource using VS.Net 2005 ? Say : Dim x as new AccessDataSource X.connectionstring="Data source="D:\mydb.mdb" X.Selectcommand="Select...
1
by: Jim McGivney | last post by:
In VS'05 I have an aspx page with a label that I am trying to populate from a field (Last) in table (Ante_Pedigree) from an Access database. In C# in a code-behind I run: AccessDataSource...
1
by: mosscliffe | last post by:
I am trying to filter an accessdatsource by adding a FilterExpression If I have Field = 2 It works fine If I have Field IN (1,5,7) it works fine So now I want it to reference a...
0
by: DC | last post by:
Why would this code give me the error "Could not load type System.Web.UI.WebControls.AccessDataSource from assembly System.Web, Version=1.0.5000.0" at line 16... <form id="form1"...
11
by: pardesiya | last post by:
Friends, I am having trouble displaying Japanese text within a textbox (or anywhere else) in an aspx page with .net 2.0 framework. Initial default text in Japanese displays perfectly but when I...
3
by: =?Utf-8?B?SmF6emE=?= | last post by:
Hi, I am trying to build a simple web page that displays records returned from an MS Access db when the user enters search criteria in a text box on the same page. My page comprises of a label,...
2
by: dorandoran | last post by:
I got this from http://www.codeproject.com/KB/aspnet/EditNestedGridView.aspx. I dont like using accessdatasource. What are my option? (what I really like is to create a class and create object in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.