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
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

New Topic/Question
Reply




MultiQuote




|