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

Q: what is missing with this code?

Hello,
Here is my code, first part of this code is adding a static record to an SQL
table and working fine, second part should get the data from the parameter
myDSDest and put into the same SQL table, I was thinking I would just used
dataset as the parameter for myDA.Update but it does not seem working, what
should I do?
Private Sub ELiveConnSQL(ByVal ConnStrDest As String, ByVal sqlStrDest As
String, ByVal myDSDest As DataSet)

Dim myConn As SqlConnection = New SqlConnection(ConnStrDest)
myConn.Open()
Try
Dim mySqlCommand As SqlCommand = New SqlCommand(sqlStrDest,
myConn)

Dim myDA As SqlDataAdapter = New SqlDataAdapter(mySqlCommand)
Dim myCommandBuilder As SqlCommandBuilder = New
SqlCommandBuilder(myDA)

' Show commands
Response.Write(myCommandBuilder.GetInsertCommand() .CommandText)

' /****** first part *****/
Dim myDTSrc As DataTable = New DataTable
myDA.Fill(myDTSrc)

'Use Insert
Dim myRowSrc As DataRow = myDTSrc.NewRow
myRowSrc("PtID") = "PtID"
myRowSrc("ADate") = "01/01/2005"
myRowSrc("ATime") = "12:00"
myRowSrc("PtName") = "PtName "
myDTSrc.Rows.Add(myRowSrc)
myDA.Update(myDTSrc)
myDTSrc.AcceptChanges()

' /****** second part *****/
Dim myDTDest As DataTable = New DataTable
myDTDest = myDSDest.Tables(0)

myDA.Update(myDTDest)

Catch ex As Exception
Response.Write(ex.Message)
Finally
myConn.Close()
End Try
End Sub

Thanks,
Jim.
Nov 19 '05 #1
0 894

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

Similar topics

3
by: S. van Beek | last post by:
Dear reader, I still have a problem with my reference libraries. In my frond end application a check procedure for missing references is available. The problem I confronted with is that...
0
by: S. van Beek | last post by:
Dear reader, I still have a problem with my reference libraries. In my frond end application a check procedure for missing references is available. The problem I confronted with is that...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
0
by: kris | last post by:
hi can any one help me out, i have written a code for Word Indexing using Dll's i think this is an incomplete code for WORD INDEX. I had encountered this error "Error! No index entries found"...
1
by: BobPaul | last post by:
I'm following code out of a howto book and this is really bugging me. This header file was created by VStudio 6.0 when I did a "Right Click: Add Member Function" CLine is a class I wrote (per the...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.