Hi ther
First off, sorry for this long post, but I think it is needed to explain my proble
I have this dataset I am working with named dsMyDataset I am trying to add data to the dataset/ access database in the following manner
Dim arMyLines As DataRow = dsMyDataset.MyR ecords.NewRo
odcMyConnection .Open(
Dim holdNumber As Intege
holdNumber = dsMyDataset.Tab les("MyRecords" ).Rows.Count +
Tr
arMyLines ("Number") = holdNumbe
arMyLines ("Date") = CDate(Label1.Te xt
arMyLines ("Home") = TextBox1.Tex
arMyLines ("Away") = TextBox2.Tex
dsMyDataset.Tab les("MyRecords" ).Rows.Add(arMy Lines
odaMyAdapter.Up date(dsMyDatase t
Catc
arMyLines.Delet e(
dsMyDataset.Cle ar(
End Tr
odcMyConnection .Close()
What I am trying to do is count the number of rows in the dataset/database, add 1 to it and put that number under the “Number” column in the database along wit the other row dat
holdNumber always contain the number 1 and the “TRY” throws an error saying, in not so many words, I have two of the same records
I removed all the primary keys in the dataset and the access database and still get the same error
I have setup the database exactly the way it is suppose to be
The problem is with the “Number” Column since I already have 1 in first row of the databas
For some reason holdNumber = dsMyDataset.Tab les("MyRecords" ).Rows.Count is not counting the number of rows in the dataset/database. It always shows 0
So adding 1 to 0 gives you 1 and the "number" column already have a 1 (the first row) in i
Any ideas on how to solve this
Once again, sorry about the length of thi 2 936
Hi Sam,
Firstoff, can you next time first copy your code in a notepath and than copy
it back in the message, that makes it more readable for everybody.
Than about your problem first a question:
Do you have a primary key in your datarow and which is that?
What you can show us maybe as well is your fill, because I get the idea that
your dataset is never filled?
Cor
Hi Co
Let me say I thought that the code I posted was as clear as I could make it. If it was't, my apologie
Anyway, Thanks for the help
Your suggestion to first fill the dataset is doing exactly what I want by doing the following. It work
Dim holdNumber As Integer = 0
odcMyConnection .Open() 'Open Connectio
odaMyAdapter.Fi ll(dsMyDataset, "MyRecords" ) 'Fill datase
holdNumber = dsMyDataset.Tab les("MyRecords" ).Rows.Count + 1 'Get and assign row count add
odcMyConnection .Open() 'Close Connectio
You want to hear something weird: At one time, I actually had this working without filling the dataset. That is strang
Thanks, again This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steven Blair |
last post by:
Hi,
Quick overview of the problem:
public bool Something( out DataSet ds )
{
bool ret=false;
try
{
|
by: JJ |
last post by:
Hi,
I need to pass a dataset to another win form along with a SqldataAdapter.
I don't want to recreate the SqlDataAdapter again either. So to pass to
another Win form in my windows form app, do I create the procedure to pass by
ref? Which means I don't need to add ByRef because it is defaulted by ref,
correct? And in the constructor of the win form that gets created. I need to
add in parameters a DataSet and SqlDataAdapter correct? What...
|
by: a |
last post by:
NEW Post
Here's my best guess at how to insert this dataset....
the code runs, but no new records are added to the sql table.
I've read and split a delimited text file into a dataset.
It looks fine in a datagrid (5 columns and 5,000 rows),
but I've been trying, without success, to then insert
the resulting dataset called "result" into a single sql
table that has an auto-increment and PK column called ID,
|
by: hcs |
last post by:
Hello,
on a datagrid when you alter the dataset and want to show the new dataset
you use datagrid.refresh().
how is this possible on a form which is based on a dataset and consists of a
number of textboxes and comboboxes? i have just tried .refesh on the
textboxes but it is not displaying the dataset. as a test i have placed a
datagrid is bound to the same dataset and it displays perfectly the updated
dataset though none of the other...
|
by: chreo |
last post by:
Sorry for weird title and sorry for my English (I'm from Poland).
This is the problem:
I have form with many controls.
There are three comboboxes - each should have table STREETS as DataSource.
1) If I connect each combobox to one Dataset then if I choose street in one
combobox it changes also in combobox 2 and 3.
So one dataset to three comboboxes is bad idea, isn't it?
But filling one dataset is fast.
| |
by: Robert Bravery |
last post by:
Hi All,
I'm New to VS.net. Trying to figure out this new dataset thingy.
Ok so I add a dataadapter with all the correct properties for a table. Then
generate the dataset. Now open the dataset and drag another table from the
server explorer, set up some relations there. Set up two grids, one a s a
parent one as a chgild. Fill the dataset, run the form
But my child grid never gets any records.
I then added another datadapter for the child...
|
by: JIM.H. |
last post by:
Hello,
I am trying to write the data I got from a web service to my table in SQL
Server
I need to append the dataset wsDS to the dataset ds and do update.
PVS.myWS.Loader load = new PVS.myWS.Loader();
DataSet wsDS=load.WsLoad();
dataGrid1.DataSource=wsDS;
string strConn = ConfigurationSettings.AppSettings;
|
by: RipperT |
last post by:
College newbie here (Instructor MIA). I have instructions to pass variable
values from one web page to another like this (VS2005):
1. Declare and create the properties on the first page (source form):
Public ReadOnly Property UserName() As String
Get
Return userNameTextBox.Text
End Get
End Property
2. Call the next page by calling the Transfer method of the Server object:
|
by: shookim |
last post by:
I don't care how one suggests I do it, but I've been searching for days
on how to implement this concept. I'm trying to use some kind of grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table tblInvoiceData.
This control also includes a textbox which the user can input a value.
These two columns are side by side and not in a vertical layout.
The user then clicks on...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
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
| |
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...
| |