We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Table doesn't have primary key.....

Thread ID:

Created:

Updated:

Platform:

Replies:

560 Jul 6,2002 12:54 AM Jul 16,2002 01:38 AM Windows Forms 1
loading
Tags: FAQ
Vipul Bhatt
Asked On July 6, 2002 12:54 AM

When i find a row it says "Table doesn't have primary key", but the primary key is defined in database. Data is ok. Connection is ok(i.e. connecting to proper database). If IsNumeric(txtCatID.Text) Then Dim r As DataRow r = VipCls.dS_Class.Tables ("e_Category").Rows.Find(txtCatID.Text) Cmb_SubCategoryOf.Text = r.Item("Category_Name") End If Subcategory_id is defined as PK.

Administrator [Syncfusion]
Replied On July 16, 2002 01:38 AM

> When i find a row it says > "Table doesn't have primary key", but the primary key is defined in database. This is a reason! PK defined in the DB! But DataGrid knows nothing about real source of data. So u have to define PK in the DataTable manually. This is a short example: // create PK DataSet dataSet = (DataSet)theGrid.DataSource; DataTable table = dataSet.Tables[theGrid.DataMember]; DataColumn[] keys = { table.Columns["ID"] }; table.PrimaryKey = keys; Now u can search. With best regards, Michael.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;