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

Edit SQL table

Hi all,

If I want to add rows to an SQL table, can I only do it like this:

Dim commd As SqlCommand = New SqlCommand("insert into table etc....")

Or is there a better way?
Additionally, is there a best pratice method for connecting to SQL and
editing tables? When I google there are just soooo many different ways
of doing it!

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #1
12 1258
Daniel <da****@madridmadridsoleado.com> wrote in news:uQkYTKndFHA.3712
@TK2MSFTNGP09.phx.gbl:
Hi all,

If I want to add rows to an SQL table, can I only do it like this:

Dim commd As SqlCommand = New SqlCommand("insert into table etc....")

Or is there a better way?


Take a look at SQL Parameters - they help protect code and simplify your
SQl statements.

Another thing - take a look at Microsoft's Data Application Block (v2 or
v3), it'll help simplify your SQL code.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2
Daniel,

What do you mean with "better". In my opinion are those thousands methods
not made for nothing.

If you need a table with only one row, than I surely advise you the method
you are using now and have absolute no better option.

Cor
Nov 21 '05 #3
Daniel <da****@madridmadridsoleado.com> wrote in news:uQkYTKndFHA.3712
@TK2MSFTNGP09.phx.gbl:
Hi all,

If I want to add rows to an SQL table, can I only do it like this:

Dim commd As SqlCommand = New SqlCommand("insert into table etc....")

Or is there a better way?


Take a look at SQL Parameters - they help protect code and simplify your
SQl statements.

Another thing - take a look at Microsoft's Data Application Block (v2 or
v3), it'll help simplify your SQL code.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #4
Daniel,

What do you mean with "better". In my opinion are those thousands methods
not made for nothing.

If you need a table with only one row, than I surely advise you the method
you are using now and have absolute no better option.

Cor
Nov 21 '05 #5
Cor Ligthert wrote:
Daniel,

What do you mean with "better". In my opinion are those thousands methods
not made for nothing.

If you need a table with only one row, than I surely advise you the method
you are using now and have absolute no better option.

Cor


Thanks, I have a table and i might be adding 50,000 rows. The app runs
as a service so this is all done in memory rather than a user using a
datagrid. so is my method still OK for this or is there a much faster
one? (like maybe create the entire table in memory and the send it all
at once to the server perhaps?????)

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #6
Cor Ligthert wrote:
Daniel,

What do you mean with "better". In my opinion are those thousands methods
not made for nothing.

If you need a table with only one row, than I surely advise you the method
you are using now and have absolute no better option.

Cor


Thanks, I have a table and i might be adding 50,000 rows. The app runs
as a service so this is all done in memory rather than a user using a
datagrid. so is my method still OK for this or is there a much faster
one? (like maybe create the entire table in memory and the send it all
at once to the server perhaps?????)

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #7
Daniel,

I would absolute for what you tell use the one you are using now.

Assuming it is everytime inserting physical at the end and no updates or
what ever.

I hope this helps,

Cor
Nov 21 '05 #8
Cor Ligthert wrote:
Daniel,

I would absolute for what you tell use the one you are using now.

Assuming it is everytime inserting physical at the end and no updates or
what ever.

I hope this helps,

Cor

Great, then i'll stick with the existing code. And if I wanted to
update an existing record would I still use this method...?

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #9
Daniel,

I would absolute for what you tell use the one you are using now.

Assuming it is everytime inserting physical at the end and no updates or
what ever.

I hope this helps,

Cor
Nov 21 '05 #10
Cor Ligthert wrote:
Daniel,

I would absolute for what you tell use the one you are using now.

Assuming it is everytime inserting physical at the end and no updates or
what ever.

I hope this helps,

Cor

Great, then i'll stick with the existing code. And if I wanted to
update an existing record would I still use this method...?

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #11
Daniel,

Probably yes, are you sure that this program is the only one who does add
and update, otherwise you have to catch the concurrency errors.

And than of course an update command and not an Insert.

Cor
Nov 21 '05 #12
Cor Ligthert wrote:
Daniel,

Probably yes, are you sure that this program is the only one who does add
and update, otherwise you have to catch the concurrency errors.

And than of course an update command and not an Insert.

Cor

OK thanks.
--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #13

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

Similar topics

4
by: Terry | last post by:
I need some help refining an MS 2000 relational databse. I have created a simple relational database using two tables, 'Student Details', 'Exam Details' and two forms, 'Input/Edit Exam Details',...
25
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records...
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
9
bhcob1
by: bhcob1 | last post by:
Hey guys, 'Update or CancelUpdate without AddNew or Edit' On my database i keep occasionly get this error when i try and edit a field, it is not everytime. It will be working fine and then this...
2
by: sara | last post by:
I use Allen Browne's Audit Trail code in everything I do and I love it. Recently, I've run into a problem I can't figure out. I have a database with about 35 lookup tables. I am creating an...
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
0
by: DJOuk | last post by:
Posted this on Asp.Net, seems to be a hard problem, I still can't work it out I have a edit button, this works fine, until I add the code that prevents the edit button from being seen by users who...
1
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.