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

error with dataset update

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
0 1160

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

Similar topics

11
by: perspolis | last post by:
hi all When I update my dataset it gives me an error which follows "Concurrecny failed, 0 record affected" I don't know why??..I don't do anything that raise this error.. just when user press...
4
by: Troy | last post by:
We recently installed the .Net framework on a windows 2000 server. Shortly after that we experienced intermitant problems running a web based program that accesses an Access 2002 database. The...
3
by: Jeff Brown | last post by:
Does anyone else ever feel like just giving up!!!!! When i edit a record and then update the database i get an error, although i can add a new record completely. The error is : An unhandled...
1
by: Mikey G | last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL database and loads a table into a Dataset, and then displays that table information in a DataGrid on a...
6
by: Mikey G | last post by:
Hi, Here is a shorter code example since the last message I posted got truncated. So the problem is I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL...
1
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened ...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
3
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent...
5
by: Mike Collins | last post by:
I am trying to export data from multiple tables in SQL Server to an XML file so I can then import it to another database. It seems to be working fine for exporting, but I am having trouble...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
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
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.