Problem with loading data in DatagridView

Error: Failed to enable constraints. One or....

Page 1 of 1

3 Replies - 1155 Views - Last Post: 05 September 2009 - 02:17 PM Rate Topic: -----

#1 Franci  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 19-August 09

Problem with loading data in DatagridView

Posted 31 August 2009 - 03:17 AM

Hi!
I'm working on a project, and one of the form is the one, where user could edit data in DataGridView. I made the Toolstrip button with an action like this:
private void Najdi_Click(object sender, EventArgs e)
		{
		   try
		   {
				string stranka = (tsbtnStranka.Text + "%");
				this.pNTableAdapter.FillByStranka(this.baza3DataSet.PN, stranka);
		   }
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}




when I start debugging it, it works fine, but when it comes to a FillByStranka statement, it throws me the following error:
" Failed to enable Constraints. One or more rows containt values violating non-null, unique, or foreign-key constraints".

In DataGridView, Values for next columns should be shown, depending on a name typed in a tsbtnStranka.Text. In this case I typed Franci so result set was like this, but with an error shown above.:

Things in quotes () shows the Data Type in database.

Stevilka(int) value = 1
Stranka(nchar(10)) value = Franci
Naloga(nchar(10)) value = Oven
Dnevnica(float) value = 11
Registrska(nchar) value = 2QK3J
Pool(nchar) value = S
Prevozeni_kilometri(float) value =33
Cas_odhoda_prihoda(nchar(30)) value = 14:10 - 15:20
Relacija(ntext(40)) value = Ivančna - Maribor <--that column has red dot with a "!" sign in it. So I assume this is the one causing problems. Should I change Data type or something?
Mesec(int) value = 8
Leto(int) value = 2009
Kilometrina (float) value = 39,6
Tarifa (float) value = 1,2

This is driving me nuts, so any help would be appreciated :rolleyes: .

Oh and 1 more thing: When I type text in tsbtnStranka.Text, i'd want to find Stranka for me even if i type only: Fr.... As you can see above I already appended "%" sign to the string, but it doesn't work for me, so I have to type Full name ( Franci ), to show a result.

Thanks for your help!

p.s. : I have to say sorry, I don't even have 10 posts yet and I already posted a new topic, but really need help :)

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with loading data in DatagridView

#2 Franci  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 19-August 09

Re: Problem with loading data in DatagridView

Posted 31 August 2009 - 03:50 AM

huh :crazy: :v: Right now I'm laughing, because i just changed Data Type from ntext(40), to nchar(30) and it seems to work :crazy: .

Thanks anyway, but I'd like to hear from you how to make auto-append, because it doesn't work with an "%" sign. Thanks :rolleyes:
Was This Post Helpful? 0
  • +
  • -

#3 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Problem with loading data in DatagridView

Posted 03 September 2009 - 06:29 PM

Wow. Glad you fixed it cuz that just looks like jaberwocky to me.

I'm interested in the translations of your properties by the way. I gathered it's croatian partially but the translations aren't working on all of them.

Thanks.
Was This Post Helpful? 0
  • +
  • -

#4 Franci  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 19-August 09

Re: Problem with loading data in DatagridView

Posted 05 September 2009 - 02:17 PM

hi =).

my translations are in a slowenian Language ;).
Najdi - Find
stranka - Customer
PN - just a name of a table :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1