473,804 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.i tem(0)._Date = DateValue
Dataset.table.i tem(0).Time = TimeValue
Dataset.table.i tem(0).Tarif = TarifValue

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

command.Command Type = CommandType.Sto redProcedure
command.Command Text = "Proc_console_U pdate_Date_And_ Tarif"

Dim ParameterSysNum As SqlParameter = command.Paramet ers.Add
("@SysNum", SqlDbType.Int)
ParameterSysNum .Value = Sys_Num_MSP_Sys tem

Dim ParameterJobId As SqlParameter =
command.Paramet ers.Add("@Jobid ", SqlDbType.VarCh ar, 20)
ParameterJobId. Value = Dataset.table.i tem(0).Job_Id

Dim ParameterJobDef Id As SqlParameter =
command.Paramet ers.Add("@JobDe fid", SqlDbType.VarCh ar, 20)
ParameterJobDef Id.Value = Dataset.table.i tem(0).Job_Def_ Id

Dim ParameterDate As SqlParameter =
command.Paramet ers.Add("@Date" , SqlDbType.VarCh ar, 20)
ParameterDate.V alue = TextBoxStamping Date.Text

Dim ParameterTime As SqlParameter =
command.Paramet ers.Add("@Time" , SqlDbType.VarCh ar, 20)
ParameterTime.V alue = TextBoxStamping Time.Text

Dim ParameterTarif As SqlParameter =
command.Paramet ers.Add("@Tarif ", SqlDbType.VarCh ar, 20)
ParameterTarif. Value = TextBoxStamping Tarif.Text

command.Command Timeout = 10000
command.Connect ion = conn

conn.Open()
command.Execute NonQuery()
' Step three ==create and exexute adapter to refill dataset
Dim command As New SqlClient.SqlCo mmand

Dim conn As New SqlClient.SqlCo nnection
conn.Connection String = frmPwd.GetStrco nnection()

command.Command Type = CommandType.Sto redProcedure
command.Command Text = "Proc_Console_G et_Info_Job"

Dim ParameterJobId As SqlParameter =
command.Paramet ers.Add("@Jobid ", SqlDbType.VarCh ar, 20)
ParameterJobId. Value = DBNull.Value

Dim ParameterSysNum As SqlParameter =
command.Paramet ers.Add("@SysNu m", SqlDbType.Int)
ParameterSysNum .Value = Sys_Num_MSP_Sys tem

command.Command Timeout = 10000
command.Connect ion = conn

MpAdaptater.Sel ectCommand = command
' Step four ==clear and refill dataset
Dataset.table.C lear()
MpAdaptater.Fil l(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 1182

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

Similar topics

11
1362
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 Save button I call Update mehtod of my SqlDataAdaptor..
4
2861
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 intranet .asp program works, but as soon as it tries to access the database for normal users, it gives us an "unspecified error" and that it can't access the data base. As the administrator, I found my access was relatively stable. Anyone else...
3
2393
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 exception of type 'System.InvalidOperationException' occurred in system.data.dll no additional info i can see Here is the update code i am using :
1
8842
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 form for editing. The table fill works fine, the delete function works fine, but when I try to update a row, the application fails with the following error message: An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in...
6
2463
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 database and loads a table into a Dataset, and then displays that table information in a DataGrid on a form for editing. The table fill works fine, the delete function works fine, but when I try to update a row, the application fails with the...
1
2317
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 - Date/Time TimeOpened - Date/Time
17
2773
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 allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
3
2420
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 table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
5
2174
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 importing the file. I am getting the following error trying to import the same xml file I just exported. "System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'GetTprsForExport'. Can someone show me where I am going wrong. Even though I say...
0
3589
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.