Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-05-2008, 09:28 PM #1
- Join Date
- Apr 2008
- Thanked 0 Times in 0 Posts
How To Make Asp.net C# Database Connection
I am trying to develop a portal system (in ASP.NET with C#) which will simply take information from a textarea or other input and place it into an MSSQL database (when a submit button is pressed possibly). Then at a later time, I would like another page to be able to take that data from the MSSQL database and place it into the web page simply as text.
I've found ways to do this with visual studio menus and so forth; however, I would much rather code the project as much as possible (only using software for shortcuts). Is there a way to (using C#) query data from an MSSQL database and place it into a variable (string or int) which can then be shown on the asp.net page? (and visa versa, insert variable information into a database)
I am currently running MSSQL 2005 and Visual Studio 2008 (and the adobe cs3 suite if that helps)...on windows xp.
I am open to learning anything necessary to make this happen. I already have a proficient knowledge of C#; therefore, I'd rather use that over VB if at all possible.
04-06-2008, 02:58 AM #2
- Join Date
- Jan 2008
- Milwaukee, WI
- Thanked 96 Times in 95 Posts
SqlConnection is the .net shortcut for working with mssql databases otherwise you can use an odbc connection.
SqlConnection will be much simpler to adjust to, just have a button that submits the form, find the value of of the box in the form and use the sql INSERT command on the object to append the data to the table.
Then to put the data in another table, use the SELECT command on the object to find the data in the table you want & store the results in a variable, then either use objectName.InnerHTML or .InnerText or <%= value %> depending on how your document is structured-Mike
"Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender
Users who have thanked mjlorbet for this post: