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

Easy Visual C# Insert Record Tip?

I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?

Feb 19 '07 #1
5 2368
On Feb 19, 1:01 pm, "gregarican" <greg.kuj...@gmail.comwrote:
I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?
Please disregard. I failed to RTFM and realize that I was looking at
the DataSet and DataTable, but needed to invoke the Insert() method
provided by the TableAdapter.

Feb 20 '07 #2
Actually, all you need is a SqlConnection and a SqlCommand, unless you want
to bind to a DataSet or DataTable.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"gregarican" <gr*********@gmail.comwrote in message
news:11*********************@j27g2000cwj.googlegro ups.com...
On Feb 19, 1:01 pm, "gregarican" <greg.kuj...@gmail.comwrote:
>I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?

Please disregard. I failed to RTFM and realize that I was looking at
the DataSet and DataTable, but needed to invoke the Insert() method
provided by the TableAdapter.

Feb 20 '07 #3
On Feb 20, 12:55 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
Actually, all you need is a SqlConnection and a SqlCommand, unless you want
to bind to a DataSet or DataTable.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"gregarican" <greg.kuj...@gmail.comwrote in message

news:11*********************@j27g2000cwj.googlegro ups.com...
On Feb 19, 1:01 pm, "gregarican" <greg.kuj...@gmail.comwrote:
I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?
Please disregard. I failed to RTFM and realize that I was looking at
the DataSet and DataTable, but needed to invoke the Insert() method
provided by the TableAdapter.- Hide quoted text -

- Show quoted text -
True. I've programmatically used the SqlConnection and SqlCommand
methods when writing ASP code. I just wanted to grasp the IDE way of
achieving something similar using Visual Studio 2005. Now I think I've
gotten my head around the DataSet, DataTable, TableAdapter, etc.
concepts newly introduced with the newer .NET releases. I come from a
background of using other languages like Ruby, Python, and Smalltak.
The middleman idea of the SQL adapter reminds me of some Smalltalk
variations that use presenters and containers to separate the GUI and
underlying logic. MVP/MVC and whatnot...

Feb 20 '07 #4
Well, you're adding a lot of overhead if all you want to do is an insert. If
you want to be able to edit and update, that's another story.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"gregarican" <gr*********@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
On Feb 20, 12:55 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
>Actually, all you need is a SqlConnection and a SqlCommand, unless you
want
to bind to a DataSet or DataTable.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"gregarican" <greg.kuj...@gmail.comwrote in message

news:11*********************@j27g2000cwj.googlegr oups.com...
On Feb 19, 1:01 pm, "gregarican" <greg.kuj...@gmail.comwrote:
I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?
Please disregard. I failed to RTFM and realize that I was looking at
the DataSet and DataTable, but needed to invoke the Insert() method
provided by the TableAdapter.- Hide quoted text -

- Show quoted text -

True. I've programmatically used the SqlConnection and SqlCommand
methods when writing ASP code. I just wanted to grasp the IDE way of
achieving something similar using Visual Studio 2005. Now I think I've
gotten my head around the DataSet, DataTable, TableAdapter, etc.
concepts newly introduced with the newer .NET releases. I come from a
background of using other languages like Ruby, Python, and Smalltak.
The middleman idea of the SQL adapter reminds me of some Smalltalk
variations that use presenters and containers to separate the GUI and
underlying logic. MVP/MVC and whatnot...

Feb 21 '07 #5
On Feb 21, 7:03 am, "Kevin Spencer" <unclechut...@nothinks.comwrote:
Well, you're adding a lot of overhead if all you want to do is an insert. If
you want to be able to edit and update, that's another story.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"gregarican" <greg.kuj...@gmail.comwrote in message

news:11**********************@a75g2000cwd.googlegr oups.com...
On Feb 20, 12:55 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
Actually, all you need is a SqlConnection and a SqlCommand, unless you
want
to bind to a DataSet or DataTable.
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com
I had the same problem once. Fixed it using the same solution.
"gregarican" <greg.kuj...@gmail.comwrote in message
>news:11*********************@j27g2000cwj.googlegr oups.com...
On Feb 19, 1:01 pm, "gregarican" <greg.kuj...@gmail.comwrote:
I have a simple VC# form that validates its text boxes' contents and I
want to insert these text box contents into an SQL Server 2005 Express
DB. I have added the DB as a data source but right off the bat most of
what I see in terms of visual controls are data grids for displaying
row data and whatnot. What's an easy way to insert my record? In other
words if I start to manually code the insert SQL method how do I refer
to the data source I have added on the visual end?
Please disregard. I failed to RTFM and realize that I was looking at
the DataSet and DataTable, but needed to invoke the Insert() method
provided by the TableAdapter.- Hide quoted text -
- Show quoted text -
True. I've programmatically used the SqlConnection and SqlCommand
methods when writing ASP code. I just wanted to grasp the IDE way of
achieving something similar using Visual Studio 2005. Now I think I've
gotten my head around the DataSet, DataTable, TableAdapter, etc.
concepts newly introduced with the newer .NET releases. I come from a
background of using other languages like Ruby, Python, and Smalltak.
The middleman idea of the SQL adapter reminds me of some Smalltalk
variations that use presenters and containers to separate the GUI and
underlying logic. MVP/MVC and whatnot...
Good point. This was more just an exercise of getting to know the new
tools at my disposal. Yeah I could've just as easily thrown in a
couple lines of code to accomplish the same things without all of the
extra file baggage :-)

Feb 21 '07 #6

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

Similar topics

3
by: Rod | last post by:
Hi, I have the following problem. I am adding a new record in a table. How can I know the ID provided by the database of the new record? suppose my table has 3 attributes: * ID:...
4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
1
by: systems analyst | last post by:
This is my modification on an original solution posted by Trevor Best (trevor@microprism.com) back in 1996. Insert the following code in a Module in your Access data base. Option Compare...
8
by: Bri | last post by:
Greetings, I'm having a very strange problem in an AC97 MDB with ODBC Linked tables to SQL Server 7. The table has an Identity field and a Timestamp field. The problem is that when a new record...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
8
by: mindwarp | last post by:
Hi, When a user submits / posts data my php script Inserts data into my database. If they refresh the script or click back and click submit again I get duplicate record. Is there an easy...
1
by: Kageoni2 | last post by:
I'm trying to add new records to my database using 4 textboxes, one for each field in my databases table. I've got ID, Firstname, Surname and Course. But I can't figure out at all how to link...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.