By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

error with dataset update

P: n/a
i update a database with a dataset and a SqlAdapter with success but when i
clear and refill my dataset i always retreive the old values.
I have to wait for 5 seconds to get the corrects values.

' Step one ==update directly the dataset in memory
Dataset.table.item(0)._Date = DateValue
Dataset.table.item(0).Time = TimeValue
Dataset.table.item(0).Tarif = TarifValue

' Step two ==create and exexute a command to update database
Dim command As New SqlClient.SqlCommand

command.CommandType = CommandType.StoredProcedure
command.CommandText = "Proc_console_Update_Date_And_Tarif"

Dim ParameterSysNum As SqlParameter = command.Parameters.Add
("@SysNum", SqlDbType.Int)
ParameterSysNum.Value = Sys_Num_MSP_System

Dim ParameterJobId As SqlParameter =
command.Parameters.Add("@Jobid", SqlDbType.VarChar, 20)
ParameterJobId.Value = Dataset.table.item(0).Job_Id

Dim ParameterJobDefId As SqlParameter =
command.Parameters.Add("@JobDefid", SqlDbType.VarChar, 20)
ParameterJobDefId.Value = Dataset.table.item(0).Job_Def_Id

Dim ParameterDate As SqlParameter =
command.Parameters.Add("@Date", SqlDbType.VarChar, 20)
ParameterDate.Value = TextBoxStampingDate.Text

Dim ParameterTime As SqlParameter =
command.Parameters.Add("@Time", SqlDbType.VarChar, 20)
ParameterTime.Value = TextBoxStampingTime.Text

Dim ParameterTarif As SqlParameter =
command.Parameters.Add("@Tarif", SqlDbType.VarChar, 20)
ParameterTarif.Value = TextBoxStampingTarif.Text

command.CommandTimeout = 10000
command.Connection = conn

conn.Open()
command.ExecuteNonQuery()
' Step three ==create and exexute adapter to refill dataset
Dim command As New SqlClient.SqlCommand

Dim conn As New SqlClient.SqlConnection
conn.ConnectionString = frmPwd.GetStrconnection()

command.CommandType = CommandType.StoredProcedure
command.CommandText = "Proc_Console_Get_Info_Job"

Dim ParameterJobId As SqlParameter =
command.Parameters.Add("@Jobid", SqlDbType.VarChar, 20)
ParameterJobId.Value = DBNull.Value

Dim ParameterSysNum As SqlParameter =
command.Parameters.Add("@SysNum", SqlDbType.Int)
ParameterSysNum.Value = Sys_Num_MSP_System

command.CommandTimeout = 10000
command.Connection = conn

MpAdaptater.SelectCommand = command
' Step four ==clear and refill dataset
Dataset.table.Clear()
MpAdaptater.Fill(Dataset.table)
between 'step two' and 'step three' I have to wait 5 seconds to have get the
corrects values

I have three TextBoxes which are binded to fields [_Date], [Time], [Tarif]

Language VB.NET 2005 with framework 2.0
SqlServer 2000 with last patch

Best regards
Nov 10 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.