473,549 Members | 2,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1098
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 programmaticall y,
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.co m

"Antonio" <ap*********@pa scarellas.com> wrote in message
news:au******** ************@co mcast.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*******@yaho o.nospammin.com > wrote in message
news:0A******** *************** ***********@mic rosoft.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
programmaticall y,
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.publi c.dotnet.langua ges.vc,microsof t.public.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.Sql Client

should help :-)

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
schrieb im Newsbeitrag news:e8******** ******@TK2MSFTN GP14.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.publi c.dotnet.langua ges.vc,microsof t.public.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.DataBind ings.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.Sql Client

should help :-)

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
schrieb im Newsbeitrag news:e8******** ******@TK2MSFTN GP14.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.publi c.dotnet.langua ges.vc,microsof t.public.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
3624
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 Linux, connecting to MS SQL Server, unless it was already pre-installed by your Linux installation, is to build your own multithreaded TCP socket...
12
2760
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 both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new...
3
2992
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 installing SQL Server 2005, my apps were working and is connecting flawlessly to a database on the SQL Server 2000. Now, whenever I connect to the same...
0
2014
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 to VS .NET 2003 (I had success doing this a while back). I am trying to connect to a named instance of SQL. This is where I think my problem is. ...
3
2005
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 (running on Win2K SP4) machine that we want to run on a Windows 2003 server machine and access it via our internal LAN. We have opened the firewall...
6
7762
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: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005,...
10
15924
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 60003/tcp
2
4945
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 Edition" via the link on: http://msdn2.microsoft.com/en-us/express/bb410792.aspx
2
3023
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 connect via SQL Management Studio to the database server from the application server I get the same error. Here is the error:
0
1986
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 ((string)(this.GetPropertyValue("Address1")));
0
7532
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, 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...
0
7462
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7492
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...
0
6059
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5381
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3510
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...
1
1957
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
1
1069
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
777
bsmnconsultancy
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...

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.