473,394 Members | 1,813 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,394 software developers and data experts.

Connecting to a SQL server

Good morning, all.

First I want to apologize for the cross-posting, but this is a major part of
the project and I would use an advice fastly.

I am trying to design a Web app using C# to attach to a SQL server.

As a test, I created a SQL connection and it tested successfully.

This is my problem:

I created a text box (txtName) which I need to bound to a specific field in
the SQL database but I can't find it in the textbox property.

Can someone point me to the right direction?

Thanks,
Antonio
Dec 7 '05 #1
6 1203
TextBox control, whether Winforms or ASP.NET, has a Text property that holds
the current value the user typed in, or which you have set programmatically,
e.g.

textBox1.Text is the value you want to insert into your SQL Table. Is this
what you are looking for? Your post doesn't have that much information.

-Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Antonio" wrote:
Good morning, all.

First I want to apologize for the cross-posting, but this is a major part of
the project and I would use an advice fastly.

I am trying to design a Web app using C# to attach to a SQL server.

As a test, I created a SQL connection and it tested successfully.

This is my problem:

I created a text box (txtName) which I need to bound to a specific field in
the SQL database but I can't find it in the textbox property.

Can someone point me to the right direction?

Thanks,
Antonio

Dec 7 '05 #2
Antonio,

You don't bind columns directly to controls in .NET.

What you do is create a SqlDataAdapter, which has insert, update,
delete, and select commands for your table.

You then fill a dataset with the adapter (through the Fill method). You
bind that do your TextBox through the Bindings propery.

Your textbox is then bound to the dataset. When you are done with it,
you can pass the data set to the data adpater through the Update method.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Antonio" <ap*********@pascarellas.com> wrote in message
news:au********************@comcast.com...
Good morning, all.

First I want to apologize for the cross-posting, but this is a major part
of the project and I would use an advice fastly.

I am trying to design a Web app using C# to attach to a SQL server.

As a test, I created a SQL connection and it tested successfully.

This is my problem:

I created a text box (txtName) which I need to bound to a specific field
in the SQL database but I can't find it in the textbox property.

Can someone point me to the right direction?

Thanks,
Antonio

Dec 7 '05 #3
Hi, Peter, thank you for your reply.

What I meant was that I am creating a web app and I need the textboxes to
get the data from a sql server. And also, add records, update records, etc.

But the primary value is what's retrieved from the sql.

Antonio

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:0A**********************************@microsof t.com...
TextBox control, whether Winforms or ASP.NET, has a Text property that
holds
the current value the user typed in, or which you have set
programmatically,
e.g.

textBox1.Text is the value you want to insert into your SQL Table. Is this
what you are looking for? Your post doesn't have that much information.

-Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Antonio" wrote:
Good morning, all.

First I want to apologize for the cross-posting, but this is a major part
of
the project and I would use an advice fastly.

I am trying to design a Web app using C# to attach to a SQL server.

As a test, I created a SQL connection and it tested successfully.

This is my problem:

I created a text box (txtName) which I need to bound to a specific field
in
the SQL database but I can't find it in the textbox property.

Can someone point me to the right direction?

Thanks,
Antonio

Dec 7 '05 #4
Hi,

I created a text box (txtName) which I need to bound to a specific field
in the SQL database but I can't find it in the textbox property.
Most probably your query will return more than one row, how you are dealing
with this?

As the other posters (nicholas ) said you need to load it first in a
dataset/datatable then you can bind it to the textbox.

As you saw the textbox itself does not support binding , you have to assign
the value directly using TextBox.Text or in the aspx page using <%# %> tags
..
btw, if you are going to cross-post (which you should not ! ) select the
correct groups , posting to
microsoft.public.dotnet.languages.vc,microsoft.pub lic.dotnet.vc.general as
nothing to do with the problem at hand

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Can someone point me to the right direction?

Thanks,
Antonio

Dec 7 '05 #5
using System.Data.SqlClient

should help :-)

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
schrieb im Newsbeitrag news:e8**************@TK2MSFTNGP14.phx.gbl...
Hi,

I created a text box (txtName) which I need to bound to a specific field
in the SQL database but I can't find it in the textbox property.
Most probably your query will return more than one row, how you are

dealing with this?

As the other posters (nicholas ) said you need to load it first in a
dataset/datatable then you can bind it to the textbox.

As you saw the textbox itself does not support binding , you have to assign the value directly using TextBox.Text or in the aspx page using <%# %> tags .
btw, if you are going to cross-post (which you should not ! ) select the
correct groups , posting to
microsoft.public.dotnet.languages.vc,microsoft.pub lic.dotnet.vc.general as
nothing to do with the problem at hand

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Can someone point me to the right direction?

Thanks,
Antonio


Dec 22 '05 #6
What do you guys mean by "...As you saw the textbox itself does not
support binding..."? It does support binding to a datatable as any other
control does.

txtBox.DataBindings.Add("Text", drDataRow, "Data table's column name");

Works for me in 1000 places in our app...

Let me know if you need any more explanation

MuZZy


MasterChief wrote:
using System.Data.SqlClient

should help :-)

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
schrieb im Newsbeitrag news:e8**************@TK2MSFTNGP14.phx.gbl...
Hi,

I created a text box (txtName) which I need to bound to a specific field
in the SQL database but I can't find it in the textbox property.

Most probably your query will return more than one row, how you are

dealing
with this?

As the other posters (nicholas ) said you need to load it first in a
dataset/datatable then you can bind it to the textbox.

As you saw the textbox itself does not support binding , you have to

assign
the value directly using TextBox.Text or in the aspx page using <%# %>

tags
.
btw, if you are going to cross-post (which you should not ! ) select the
correct groups , posting to
microsoft.public.dotnet.languages.vc,microsoft.pub lic.dotnet.vc.general as
nothing to do with the problem at hand

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Can someone point me to the right direction?

Thanks,
Antonio


Dec 22 '05 #7

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

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
3
by: Ann Marinas | last post by:
Hi there, I am currently developing an ASP.NET program that connects to a SQL Server 2000 database. I also have SQL Server 2005 Express installed on the same local machine. Prior to...
0
by: cj.snead | last post by:
Hello, I am having trouble connecting to a remote named instance of SQL Server via Pocket PC. I have had absolutely no luck connecting with VS 2005 (even to a default instance), so I wen't back...
3
by: Vinod R.Shenoy | last post by:
Hi All, Came across a post wherin you had helped somebody with a similar problem and was wondering if you could help us out with it. Our problem is , We have a development SQL Server 2000...
6
by: Todd Brewer | last post by:
Windows Server 2000 ASP.NET 2.0 SQL Server 2000 (on a physically seperate server) I moved an ASP.NET 2.0 application from a development server to production, and am getting the following error:...
10
by: mairhtin o'feannag | last post by:
Hello, I'm having problems connecting to my new v9 db box. The pertinent information is below: DB2_db2inst1 60000/tcp DB2_db2inst1_1 60001/tcp DB2_db2inst1_2 60002/tcp DB2_db2inst1_END...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
2
by: orandov | last post by:
Hi, I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.