|
That helped a lot. Thanks! It looks like it can't find a file that the class it's trying to invoke is trying to use. I had pulled some code into it's own SerialNumber class. That's the problem. Thank you!
|
|
|
|
|
Hello again! Another problem needs to be solved, when users click button1 it creates new row in table with text from textbox1. I need it before adding created row to table to check if record already exists in column "iestade_nosaukums". Here is button1 code for adding new row.
private void button1_Click(object sender, EventArgs e)
{
datori_database.iestadesRow newiestadesRow;
newiestadesRow = datori_database.iestades.NewiestadesRow();
newiestadesRow.iestade_nosaukums = textBox1.Text;
this.datori_database.iestades.Rows.Add(newiestadesRow);
this.iestadesTableAdapter.Update(this.datori_database.iestades);
this.Validate();
this.iestadesBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.datori_database);
}
|
|
|
|
|
In the time between "checking" and "doing your thing", changes could occur. It's no fun to hunt for race-conditions in code.
The best way is to skip that check altogether, and deal with an exception if it occurs.
Bastard Programmer from Hell
|
|
|
|
|
yeah, you are right, it is easier this way, everything works now as it should. Thanks!
|
|
|
|
|
Rather than determining whether or not the record already exists, I would tend to use the following SQL:
INSERT INTO MyTable(SomeColumn)
SELECT @MyData
WHERE NOT EXISTS (SELECT SomeColumn FROM MyTable WHERE SomeColumn = @MyData) If you do a simple check, and then you do an insert and you are running this in a multi-user environment, you run the risk of adding a duplicate simply because you have two users doing the same checks at the same time.
As an alternative, put a unique constraint on the value you are trying to keep unique, and then just trap the resulting exception (this is not an ideal solution, but it is pretty much foolproof).
|
|
|
|
|
Thanks. I will try it later
|
|
|
|
|
Hello. So i have a filter that filters rows in datagridview:
private void button3_Click(object sender, EventArgs e)
{
iestadesBindingSource.Filter = string.Format("iestade_nosaukums like '%{0}%'", textBox1.Text.Trim().Replace("'", "''"));
}
When it doesn't find any records with criteria from textBox1.Text i need it to make visible label1.
|
|
|
|
|
Saidrex wrote: When it doesn't find any records with criteria from textBox1.Text i need it to make visible label1.
Where's the question? Simply check if your bindingsource contains records, and if it doesn't, hide the label.
Bastard Programmer from Hell
|
|
|
|
|
How to check if bindingsource contains records?
|
|
|
|
|
The bindingsource will not contain records directly; you would have assigned a datasource previously. Probably a list or a datatable
Bastard Programmer from Hell
|
|
|
|
|
it contains records from my datasource which contains tables from my database. I need it to check if there is any results after filtering. Any ideas how to do it? =)
|
|
|
|
|
Saidrex wrote: Any ideas how to do it? =)
Try MSDN[^].
"The Count property gets the number of items in the underlying list represented by the List property as modified by the value of the Filter property."
Bastard Programmer from Hell
|
|
|
|
|
yay, thanks, it works, my code:
private void button3_Click(object sender, EventArgs e)
{
iestadesBindingSource.Filter = string.Format("iestade_nosaukums like '%{0}%'", textBox1.Text.Trim().Replace("'", "''"));
int a = iestadesBindingSource.Count;
if ( a == 0)
{
label1.Text = "Error. No records with this keyword.";
}
}
|
|
|
|
|
Hi All,
We develop a windows application that can deal with sql server database directly or by Web Service,
We Want to add a new dialog to our setup wizard that configure the previous settings.
2 Radio buttons-> web service, directly
2 Text Boxes-> one for Web Service Url and the other for direct sql Connection.
Please help me if you know how to do that.
Thanks All.
|
|
|
|
|
|
i try for create web setup(open-file-new-project-other project type-setup and deployment and select web setup project ) but i select project output from right click web application folder and select project output but not get any information in combo box of project so, plz guide me for create web setup in vs2008 step by step and indicate my problem
|
|
|
|
|
|
|
Dear Sirs,
I need to restrict the colours and the fontname of a control that will be displayed on a property grid.
For example, in my application I only will allow the user select on of the follow FontNames for a control in a propertygrid: {Arial, Calibri, Comic Sans MS, Arial Black, and others}.
The same will be happened with the allowed colours do be selected.
I would also know the easiest way to hide all properties, except "Size", "Location", "Font", "Backcolour", and some properties that I've created. I've learned to use Browsable(true/False), or using BrowsableAttributes. But there are some properties within an Attribute that should be hide.
Thanks,
Almerindo Paiva
|
|
|
|
|
Create a proxy; a new class that contains the properties that you want to set.
Bastard Programmer from Hell
|
|
|
|
|
Hi to all expert,
I am a beginner in C# XNA. Can I ask why is there a CROSS in my Viewport?
Thank you
|
|
|
|
|
Philip Solomon See wrote: why is there a CROSS in my Viewport?
It's become a Christian.
(Sorry, I couldn't resist...)
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Hi Does anyone know of a good book that actually has C# Coding in it to use as a good reference book. Thanks.
|
|
|
|
|
Almost all of them, provided they do not have multiple exclamation marks, the words "for dummies" or the word "in x days" in the title.
Have a look the the Wrox[^] selection, or Addison-Wesley[^]
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
CLR via C# is a very good book if you want to spend learning more time about the internals of the .Net framework (rather than the programming language itself).
|
|
|
|