StrataFrame Forum
Back
Login
Login
Home
»
.NET Forums
»
General .NET Discussion
»
Inserting records into a table....
Inserting records into a table....
Post Reply
Like
0
Inserting records into a table....
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
StrataFrame Team
S
StrataFrame Team
posted 17 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
It is very clever. And bulk updates might not be for you
Reply
Like
0
StarkMike
StarkMike
posted 17 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 436,
Visits: 944
Thanks for the suggestion Ben. I thought my way was pretty clever I just was curious if there was a better way.
Reply
Like
0
StrataFrame Team
S
StrataFrame Team
posted 17 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Not without specifying the parameters explicitly. And building the command dynamically. You might also look at the SQL bulk update functionality... especially if you're updating more than just 4 rows. System.Data.SqlClient.SqlBulkCopy is the object, I think.
Reply
Like
0
StarkMike
StarkMike
posted 17 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 436,
Visits: 944
I'm importing data from a CSV file. I am reading the file in using TextFieldParser and while I read it in I am building an INSERT sql statement on the fly. Here is what the SQL statement looks like:
INSERT INTO STITagsImport (TagNumber)
SELECT tbl.Expr1 FROM (
SELECT 'ATV0E0' AS Expr1 UNION ALL
SELECT 'ATV0E0' AS Expr1 UNION ALL
SELECT '1180849' AS Expr1 UNION ALL
SELECT 'END' AS Expr1
) AS tbl
The reason I am doing this is because I dont want to make four separate round trips to the database with four separate INSERT statements. I was just wondering if there was a better way.
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search