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

Updating table in code

I have been trying to update a record that I edited and can't seem to figure
out what I'm missing. Here is the code that I have to load the record on
the form:

'
************************************************** **************************
*****************
Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name")
Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name")
Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03")
Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

And here is the code for the update:

'
************************************************** **************************
*****************
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

Try
DirectCast(BindingContext(objDS.Tables(0)),
CurrencyManager).EndCurrentEdit()
Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub
What am I missing? Do I need to code the INSERT, UPDATE, and DELETE command
and if so, where do I put them? I have nine fields that I'm working with so
please help me update my record. Any code examples would be appreciated.

Thanks,

Gary
Nov 20 '05 #1
22 1575
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor
Nov 20 '05 #2
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor
Nov 20 '05 #3
Hi Cor,

I tried the code you suggested and I get the following error message:

Update unable to find TableMapping['Table'] or Datatable 'Table'

Any suggestions?

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor

Nov 20 '05 #4
Hi Cor,

I tried the code you suggested and I get the following error message:

Update unable to find TableMapping['Table'] or Datatable 'Table'

Any suggestions?

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor

Nov 20 '05 #5
Cor,

I just tried the following change (Putting the table name 'Contact' in) and
I received an error saying "Incorrect syntax near the word 'trigger'".
HELP! Do I need to specify UPDATE statements? If so where EXACTLY do I put
them?

Gary

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor

Nov 20 '05 #6
Cor,

I just tried the following change (Putting the table name 'Contact' in) and
I received an error saying "Incorrect syntax near the word 'trigger'".
HELP! Do I need to specify UPDATE statements? If so where EXACTLY do I put
them?

Gary

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Hi Gary,

Where did you let that special code, that should work, although it is not
standard, I did find it very nice to check concurrency errors.

However change it in this what is standard used in this newsgroups and in
samples.

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
BindingContext(objDS.Tables(0)).EndCurrentEdit()
Try
if objDS.haschanges then
Da.update(objDS)
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Cor

Nov 20 '05 #7
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does not
know nothing about what he has to build. Replace the commandbuilder to the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Nov 20 '05 #8
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does not
know nothing about what he has to build. Replace the commandbuilder to the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Nov 20 '05 #9
Hi Cor,

I did go back and look at the messages from the other day and I just don't
see what else I need to do. I'm sorry but I don't understand. I did place
the CommandBuilder before the fill as you requested. I don't understand the
"Replace the commandbuilder to the place where it has all the information"
line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does not know nothing about what he has to build. Replace the commandbuilder to the place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before last week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Nov 20 '05 #10
Hi Cor,

I did go back and look at the messages from the other day and I just don't
see what else I need to do. I'm sorry but I don't understand. I did place
the CommandBuilder before the fill as you requested. I don't understand the
"Replace the commandbuilder to the place where it has all the information"
line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does not know nothing about what he has to build. Replace the commandbuilder to the place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before last week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Nov 20 '05 #11
Hi Gary,

It should work now, I do not look anymore to this newsgroup today, (It is
here 20:00 saterday night, however I was curious if you did succeed)
However past in that part of code from the fill and from the update, I
really do not know why it should not work

Before I did send the message some days ago I tested it with your previous
methode completly and now with that new methode I did test it also.

I look to it what is here tomorrow morning, there should be something very
simple what is on the wrong place.

Cor
Nov 20 '05 #12
Hi Gary,

It should work now, I do not look anymore to this newsgroup today, (It is
here 20:00 saterday night, however I was curious if you did succeed)
However past in that part of code from the fill and from the update, I
really do not know why it should not work

Before I did send the message some days ago I tested it with your previous
methode completly and now with that new methode I did test it also.

I look to it what is here tomorrow morning, there should be something very
simple what is on the wrong place.

Cor
Nov 20 '05 #13
Gary:

1) Do yourself a favor and get rid of the concatenated sql, opt for
Paramaterized queries instead. It's not the problem you are asking about,
but it can introduce some really really bad security problems, not to
mention performance issues.
strSQL = "Select * from Contact WHERE sysID = @g_sysID"
cmd.Parameters.Add("@g_sysID", SqlDbType.WhateverType,
FieldLengthInDb).value = g_sysID

2) The commandbuilder should genereate these for you (Update, Delete etc)
but CB's really suck. The problem is that you aren't calling update that I
can see. In your btn_Save code, add DA.Update(objDS1, "TableName")

That should fix it for you.

Let me know if not.

Bill

"Gary" <ra******@yahoo.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I have been trying to update a record that I edited and can't seem to figure out what I'm missing. Here is the code that I have to load the record on
the form:

'
************************************************** ************************** *****************
Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name") Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name") Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03") Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

And here is the code for the update:

'
************************************************** ************************** *****************
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

Try
DirectCast(BindingContext(objDS.Tables(0)),
CurrencyManager).EndCurrentEdit()
Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub
What am I missing? Do I need to code the INSERT, UPDATE, and DELETE command and if so, where do I put them? I have nine fields that I'm working with so please help me update my record. Any code examples would be appreciated.

Thanks,

Gary

Nov 20 '05 #14
Gary:

1) Do yourself a favor and get rid of the concatenated sql, opt for
Paramaterized queries instead. It's not the problem you are asking about,
but it can introduce some really really bad security problems, not to
mention performance issues.
strSQL = "Select * from Contact WHERE sysID = @g_sysID"
cmd.Parameters.Add("@g_sysID", SqlDbType.WhateverType,
FieldLengthInDb).value = g_sysID

2) The commandbuilder should genereate these for you (Update, Delete etc)
but CB's really suck. The problem is that you aren't calling update that I
can see. In your btn_Save code, add DA.Update(objDS1, "TableName")

That should fix it for you.

Let me know if not.

Bill

"Gary" <ra******@yahoo.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I have been trying to update a record that I edited and can't seem to figure out what I'm missing. Here is the code that I have to load the record on
the form:

'
************************************************** ************************** *****************
Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name") Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name") Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03") Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

And here is the code for the update:

'
************************************************** ************************** *****************
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

Try
DirectCast(BindingContext(objDS.Tables(0)),
CurrencyManager).EndCurrentEdit()
Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub
What am I missing? Do I need to code the INSERT, UPDATE, and DELETE command and if so, where do I put them? I have nine fields that I'm working with so please help me update my record. Any code examples would be appreciated.

Thanks,

Gary

Nov 20 '05 #15
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter)
..
..
..
i.e. the select command (and, incidentally, the connection) is set up before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't
see what else I need to do. I'm sorry but I don't understand. I did place the CommandBuilder before the fill as you requested. I don't understand the "Replace the commandbuilder to the place where it has all the information"
line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does

not
know nothing about what he has to build. Replace the commandbuilder to

the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before

last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")


Nov 20 '05 #16
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter)
..
..
..
i.e. the select command (and, incidentally, the connection) is set up before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't
see what else I need to do. I'm sorry but I don't understand. I did place the CommandBuilder before the fill as you requested. I don't understand the "Replace the commandbuilder to the place where it has all the information"
line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he does

not
know nothing about what he has to build. Replace the commandbuilder to

the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before

last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")


Nov 20 '05 #17
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name")
Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name")
Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03")
Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the select command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter)
.
.
.
i.e. the select command (and, incidentally, the connection) is set up before using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't see what else I need to do. I'm sorry but I don't understand. I did

place
the CommandBuilder before the fill as you requested. I don't understand

the
"Replace the commandbuilder to the place where it has all the information" line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he
does not
know nothing about what he has to build. Replace the commandbuilder
to the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before

last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")



Nov 20 '05 #18
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name")
Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name")
Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03")
Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the select command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter)
.
.
.
i.e. the select command (and, incidentally, the connection) is set up before using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't see what else I need to do. I'm sorry but I don't understand. I did

place
the CommandBuilder before the fill as you requested. I don't understand

the
"Replace the commandbuilder to the place where it has all the information" line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
Hi Gary,

As forever I do not want to change to much in peoples code.

This is your code, how can that commandbuilder build commands if he
does not
know nothing about what he has to build. Replace the commandbuilder
to the
place where it has all information.
(Before the fill)

This did cost time to see this.

And others place it direct for the update, which I messaged you before

last
week.

Cor

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)
Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

DA.Fill(objDS, "Contact")



Nov 20 '05 #19
Some questions:

Where does objDS get defined?
If you add a breakpoint on the Try line of your btnSave_Click and then step
through the code (use F11) then what happens?
If it gets to the line DA.Update(objDS, "Contact") then what does SQL
profiler show?

"Gary" <ra******@yahoo.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name") Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name") Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03") Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the

select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter) .
.
.
i.e. the select command (and, incidentally, the connection) is set up

before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't see what else I need to do. I'm sorry but I don't understand. I did

place
the CommandBuilder before the fill as you requested. I don't understand the
"Replace the commandbuilder to the place where it has all the information" line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
> Hi Gary,
>
> As forever I do not want to change to much in peoples code.
>
> This is your code, how can that commandbuilder build commands if he does not
> know nothing about what he has to build. Replace the commandbuilder to the
> place where it has all information.
> (Before the fill)
>
> This did cost time to see this.
>
> And others place it direct for the update, which I messaged you

before last
> week.
>
> Cor
>
> strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'" > objDS.Clear()
>
> Dim cmb As SqlClient.SqlCommandBuilder = New
> SqlClient.SqlCommandBuilder(DA)
> Dim selectCommand As New SqlClient.SqlCommand(strSQL)
> DA.SelectCommand = selectCommand
> DA.SelectCommand.Connection = CN
>
> DA.Fill(objDS, "Contact")
>
>
>



Nov 20 '05 #20
Some questions:

Where does objDS get defined?
If you add a breakpoint on the Try line of your btnSave_Click and then step
through the code (use F11) then what happens?
If it gets to the line DA.Update(objDS, "Contact") then what does SQL
profiler show?

"Gary" <ra******@yahoo.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS, "Contact.Last_name") Me.txtFullName.DataBindings.Add("Text", objDS, "Contact.full_name") Me.txtAddress1.DataBindings.Add("Text", objDS, "Contact.con1_02_03") Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06")
Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")

End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -

The CommandBuilder cannot function correctly unless it knows what the

select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn)
Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter) .
.
.
i.e. the select command (and, incidentally, the connection) is set up

before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Hi Cor,

I did go back and look at the messages from the other day and I just don't see what else I need to do. I'm sorry but I don't understand. I did

place
the CommandBuilder before the fill as you requested. I don't understand the
"Replace the commandbuilder to the place where it has all the information" line. To me it is already there. Can you elaborate more or give me a
better example of what I have to do? I am lost.

Thanks,

Gary

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
> Hi Gary,
>
> As forever I do not want to change to much in peoples code.
>
> This is your code, how can that commandbuilder build commands if he does not
> know nothing about what he has to build. Replace the commandbuilder to the
> place where it has all information.
> (Before the fill)
>
> This did cost time to see this.
>
> And others place it direct for the update, which I messaged you

before last
> week.
>
> Cor
>
> strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'" > objDS.Clear()
>
> Dim cmb As SqlClient.SqlCommandBuilder = New
> SqlClient.SqlCommandBuilder(DA)
> Dim selectCommand As New SqlClient.SqlCommand(strSQL)
> DA.SelectCommand = selectCommand
> DA.SelectCommand.Connection = CN
>
> DA.Fill(objDS, "Contact")
>
>
>



Nov 20 '05 #21
I made two changes. One was removing the line If objDS.HasChanges
Then

and the other was had to do with the SQL statement. In the table, there was
a field called [trigger]. That was the definition so I changed the name to
trigger1. That seemed to solve the problem. Now everything works and I can
go back to work again.

I was pulling out the remaining hairs on my head over this.

Thanks loads,

Gary

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:uk*************@tk2msftngp13.phx.gbl...
Some questions:

Where does objDS get defined?
If you add a breakpoint on the Try line of your btnSave_Click and then step through the code (use F11) then what happens?
If it gets to the line DA.Update(objDS, "Contact") then what does SQL
profiler show?

"Gary" <ra******@yahoo.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS,

"Contact.Last_name")
Me.txtFullName.DataBindings.Add("Text", objDS,

"Contact.full_name")
Me.txtAddress1.DataBindings.Add("Text", objDS,

"Contact.con1_02_03")
Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06") Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")
End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk>

wrote
in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -
The CommandBuilder cannot function correctly unless it knows what the

select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn) Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter) .
.
.
i.e. the select command (and, incidentally, the connection) is set up

before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
> Hi Cor,
>
> I did go back and look at the messages from the other day and I just

don't
> see what else I need to do. I'm sorry but I don't understand. I did place
> the CommandBuilder before the fill as you requested. I don't understand the
> "Replace the commandbuilder to the place where it has all the

information"
> line. To me it is already there. Can you elaborate more or give me a > better example of what I have to do? I am lost.
>
> Thanks,
>
> Gary
>
> "Cor Ligthert" <no**********@planet.nl> wrote in message
> news:O2*************@TK2MSFTNGP09.phx.gbl...
> > Hi Gary,
> >
> > As forever I do not want to change to much in peoples code.
> >
> > This is your code, how can that commandbuilder build commands if
he does
> not
> > know nothing about what he has to build. Replace the
commandbuilder to
> the
> > place where it has all information.
> > (Before the fill)
> >
> > This did cost time to see this.
> >
> > And others place it direct for the update, which I messaged you

before > last
> > week.
> >
> > Cor
> >
> > strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'" > > objDS.Clear()
> >
> > Dim cmb As SqlClient.SqlCommandBuilder = New
> > SqlClient.SqlCommandBuilder(DA)
> > Dim selectCommand As New SqlClient.SqlCommand(strSQL)
> > DA.SelectCommand = selectCommand
> > DA.SelectCommand.Connection = CN
> >
> > DA.Fill(objDS, "Contact")
> >
> >
> >
>
>



Nov 20 '05 #22
I made two changes. One was removing the line If objDS.HasChanges
Then

and the other was had to do with the SQL statement. In the table, there was
a field called [trigger]. That was the definition so I changed the name to
trigger1. That seemed to solve the problem. Now everything works and I can
go back to work again.

I was pulling out the remaining hairs on my head over this.

Thanks loads,

Gary

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:uk*************@tk2msftngp13.phx.gbl...
Some questions:

Where does objDS get defined?
If you add a breakpoint on the Try line of your btnSave_Click and then step through the code (use F11) then what happens?
If it gets to the line DA.Update(objDS, "Contact") then what does SQL
profiler show?

"Gary" <ra******@yahoo.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Thanks for giving me an example, but here is my code and it works bringing
in the record but I'm not sure it's correct

Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strSQL As String

strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'"
objDS.Clear()

Dim selectCommand As New SqlClient.SqlCommand(strSQL)
DA.SelectCommand = selectCommand
DA.SelectCommand.Connection = CN

Dim cmb As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(DA)

DA.Fill(objDS, "Contact")

Me.txtFirstName.DataBindings.Add("Text", objDS,
"Contact.first_name")
Me.txtLastName.DataBindings.Add("Text", objDS,

"Contact.Last_name")
Me.txtFullName.DataBindings.Add("Text", objDS,

"Contact.full_name")
Me.txtAddress1.DataBindings.Add("Text", objDS,

"Contact.con1_02_03")
Me.txtPhone.DataBindings.Add("Text", objDS, "Contact.Phone1")
Me.txtCity.DataBindings.Add("Text", objDS, "Contact.con1_02_05")
Me.txtState.DataBindings.Add("Text", objDS, "Contact.con1_02_06") Me.txtZip.DataBindings.Add("Text", objDS, "Contact.con1_02_07")
Me.txtEMail.DataBindings.Add("Text", objDS, "Contact.con1_03_01")
End Sub

When I want to update, I have the following code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

BindingContext(objDS.Tables("Contact")).EndCurrent Edit()

Try
If objDS.HasChanges Then
DA.Update(objDS, "Contact")
End If

Me.Close()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

but the above code doesn't work. HELP

"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk>

wrote
in message news:%2******************@TK2MSFTNGP09.phx.gbl...
Apologies for butting in, but just trying to clarify one of Cor's points -
The CommandBuilder cannot function correctly unless it knows what the

select
command for the adapter is. The help file example looks like this...

Public Function SelectSqlSrvRows(myDataSet As DataSet, myConnection As
String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New SqlConnection(myConnection)
Dim myDataAdapter As New SqlDataAdapter()
myDataAdapter.SelectCommand = New SqlCommand(mySelectQuery, myConn) Dim custCB As SqlCommandBuilder = New SqlCommandBuilder(myDataAdapter) .
.
.
i.e. the select command (and, incidentally, the connection) is set up

before
using the CommandBuilder.

"Gary" <ra******@yahoo.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
> Hi Cor,
>
> I did go back and look at the messages from the other day and I just

don't
> see what else I need to do. I'm sorry but I don't understand. I did place
> the CommandBuilder before the fill as you requested. I don't understand the
> "Replace the commandbuilder to the place where it has all the

information"
> line. To me it is already there. Can you elaborate more or give me a > better example of what I have to do? I am lost.
>
> Thanks,
>
> Gary
>
> "Cor Ligthert" <no**********@planet.nl> wrote in message
> news:O2*************@TK2MSFTNGP09.phx.gbl...
> > Hi Gary,
> >
> > As forever I do not want to change to much in peoples code.
> >
> > This is your code, how can that commandbuilder build commands if
he does
> not
> > know nothing about what he has to build. Replace the
commandbuilder to
> the
> > place where it has all information.
> > (Before the fill)
> >
> > This did cost time to see this.
> >
> > And others place it direct for the update, which I messaged you

before > last
> > week.
> >
> > Cor
> >
> > strSQL = "Select * from Contact WHERE sysID = '" & g_sysID & "'" > > objDS.Clear()
> >
> > Dim cmb As SqlClient.SqlCommandBuilder = New
> > SqlClient.SqlCommandBuilder(DA)
> > Dim selectCommand As New SqlClient.SqlCommand(strSQL)
> > DA.SelectCommand = selectCommand
> > DA.SelectCommand.Connection = CN
> >
> > DA.Fill(objDS, "Contact")
> >
> >
> >
>
>



Nov 20 '05 #23

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
1
by: Mark | last post by:
I'm having a problem updating recordsin an Access DB table. I can update other tables in this db with no problem, and I can dreate new record in all of the tables (including this one.)> But I can't...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
6
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection =...
0
by: teammcs | last post by:
Hey all, I'm new around here but do Admin over @ PHPHelp.com... I've been developing a project for my degree which is basically based around an ATM machine. Basically my problem is related to...
33
by: bill | last post by:
In an application I am writing the user can define a series of steps to be followed. I save them in a sql database using the field "order" (a smallint) as the primary key. (there are in the range...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.