Hi,
I thought it isn't possible to use a SqlDataAdapter and a Databound grid
when there isn't a 'real' primary key on the table.
Although, is there a way to use it, and define somewhere in the
SqlDataAdapter my own primary key on the table?
I can't add a primary key to the table, so I guess that's the only way to
find a solution?
Any help would be really appreciated!
Thans a lot in advance,
Pieter 5 4007
Hi,
Yes, dataadapter doesn't require a primary key. It is required just by the
wizards to generate insert/update/delete statements.
Also, dataadapter has nothing to do with binding to table.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info
"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l... Hi,
I thought it isn't possible to use a SqlDataAdapter and a Databound grid when there isn't a 'real' primary key on the table. Although, is there a way to use it, and define somewhere in the SqlDataAdapter my own primary key on the table?
I can't add a primary key to the table, so I guess that's the only way to find a solution?
Any help would be really appreciated!
Thans a lot in advance,
Pieter
Pieter,
From where do you have that idea?
Cor
You can create your own CRUD statements and avoid creating a magic key.
Simply write the INSERT, UPDATE and DELETE statement rather than relying on
the DataAdapter to automagically create one for you. As long as the SQL for
all four statements is correct, you are up and running.
--
Gregory A. Beamer
MVP; MCP: +I, SD, SE, DBA
*************** *************** *************** ****
Think outside the box!
*************** *************** *************** ****
"DraguVaso" <pi**********@h otmail.com> wrote in message
news:#Z******** ******@TK2MSFTN GP09.phx.gbl... Hi,
I thought it isn't possible to use a SqlDataAdapter and a Databound grid when there isn't a 'real' primary key on the table. Although, is there a way to use it, and define somewhere in the SqlDataAdapter my own primary key on the table?
I can't add a primary key to the table, so I guess that's the only way to find a solution?
Any help would be really appreciated!
Thans a lot in advance,
Pieter
Hehe I don't know anymore.
But it's great that it seems I'm able do do use it, although with writing
the upate statements myself, but that's no problem.
thanks a lot!
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uJ******** ******@TK2MSFTN GP15.phx.gbl... Pieter,
From where do you have that idea?
Cor
Pieter,
You was not telling that you wanted to update (and therefore my question).
Despite all others answers won't I not know what to update or to delete when
I don't have that key. (Inserting will go when there is an autoincrementke y
or a Guid used for the uniqueidentifie r).
Just my thought,
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DraguVaso |
last post by:
Hi,
I thought it isn't possible to use a SqlDataAdapter and a Databound grid
when there isn't a 'real' primary key on the table.
Although, is there a way to use it, and define somewhere in the
SqlDataAdapter my own primary key on the table?
I can't add a primary key to the table, so I guess that's the only way to
find a solution?
|
by: serge |
last post by:
I have a scenario where two tables are in a One-to-Many relationship
and I need to move the data from the Many table to the One table so
that it becomes a One-to-One relationship.
I need to salvage the records from the many table and without going
into detail, one of the reasons I can't do the opposite as
there are records in the ONE table that I need to keep even if they
don't have any child records in the MANY table.
Below I created...
|
by: serge |
last post by:
I ran into a table that is used a lot. Well less than
100,000 records. Maybe not a lot of records but i believe
this table is used often. The table has 26 fields, 9 indexes
but no Primary Key at all!
There are no table relationships defined in this database, no
Natural keys, only Surrogate keys in the database.
1- Maybe an odd question but is it normal to have 1/3 of the
table's fields as indexes? Is this a valid question or it really
|
by: Scott Ribe |
last post by:
I've got a problem which I think may be a bug in Postgres, but I wonder if
I'm missing something. Two tables, A & B have foreign key relations to each
other. A 3rd table C, inherits from A. A stored procedure updates a row in
C, adds a row each in B & C. I get an integrity violation. All the foreign
keys are deferrable, and the stored procedure is called from within a
transaction with constraints deferred. (And the foreign keys do refer to...
|
by: goodstart123 |
last post by:
For example, the following code works fine without SqlConnection.
Any Answer to the question?
string connectionString =
"server=YourServer; uid=sa;
pwd=YourPassword; database=ProgASPDotNetBugs";
// get records from the Bugs table
string commandString =
"Select BugID, Description from Bugs";
| |
by: Alex Satrapa |
last post by:
There's some mention in the (old!) documentation that constraints such as foreign keys won't include data from inheriting tables, eg:
CREATE TABLE foo (
id SERIAL PRIMARY KEY
);
CREATE TABLE bar (
attribute integer NOT NULL
) INHERITS (foo);
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID SalesManName
AT Alan Time
|
by: Aaron |
last post by:
Hi,
The SqlDataAdapter.FillSchema method will automatically setup things
like the primary keys, auto increment, etc based on the settings on the
SQL Server. However, if you create a datatable using the SQL statement
that joins together data from multiple data tables, then FillSchema
does not work (as much? at all??). For example, if I use the following
query:
SELECT Material.*, Color.Color AS Color
|
by: Adrien Reboisson |
last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I
installed SQL Server 2005 Express, created a blank project, dropped a
TreeView, a ListView and a DataGridView : DB objects (Databases, tables,
SPs, and so on) are displayed in the tree, table colums definitions in
the list and I want to display the selected table content in the
DataGridView. So far so good. Currently, I succedded in loading the
treeview and the...
|
by: niccolem |
last post by:
HI:
Can someone tell me HOW to insert a automatic number after my user inserts new data from text boxes into the dataset. I keep getting this error:
Cannot insert the value NULL into column 'id', table; column does not allow nulls. INSERT fails. (ID IS MY KEY)
I can update & delete fine, but when I try to insert, I cannot figure out how to get the primary key inserted. I'm new @ this & I think I've confused myself....
THANK YOU
Dim...
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s 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: 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 project—planning, coding, testing, and deployment—without 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: 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...
|
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...
| |