|
I have a strnge situation thta I just can't understand, any help or leads would be appreciated
In my data layer I create BindingSource objects:
public abstract class SimpleObjects : System.Data.DataTable
{
protected BindingSource binding = new BindingSource();
protected void Init()
{
sqlAdap.SelectCommand = selectCommand;
sqlAdap.TableMappings.Add(tableMapping);
sqlAdap.FillSchema(this, SchemaType.Mapped);
binding.DataSource = this;
}
public BindingSource Binding
{
get { return binding; }
}
}
I make the BindingSource (binding) object available as a property for all my SimpleObjects for forms to use. Wrks well in most cases but my problem is sometimes the binding goes berzerk when I add DataRows to certain SimpleObjects and it seems to happen when you add rows to child Tables. What happens most of the time is a DataGridView showing a child object will show a row in blue but if I ask the currently binded Object to the BindingSource, it returns me usually the first row. This definitelly happens only if a DataRow was added. Not sure What is happenning and not sure what to do. Any help would be greatly appreciated.
|
|
|
|
|
Is there a way to return the resultset of a stored procedure to a dataset and then programatically "read" the names of each column in the dataset?
So in other words, if a stored procedure returns 3 columns of data(customerID, customerName, and qtyOrdered) and I insert that data into a dataset, how could I set an array to read the names of each column. This way the final array would ultimately look like the following:
array[0] = "customerID";
array[1] = "customerName";
array[2] = "qtyOrdered";
Can this be done?
Thanks.
-Goalie35
|
|
|
|
|
Goalie35 wrote: Is there a way to return the resultset of a stored procedure to a dataset and then programatically "read" the names of each column in the dataset?
DataSets don't have columns. DataSets act as a repository for DataTable objects. It is the DataTable objects that have columns.
Query the Columns collection of your DataTable to get the names of the columns.
Paul Marfleet
|
|
|
|
|
Hi friends
I want writ a code that show a special tabpage when form load. How I can do it?
thanks
|
|
|
|
|
this code selects the second tab on form load:
private void Form1_Load(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
|
|
|
|
|
-I am querying MS AD Objects and want to transfer the properties to my own object with as little code as possible.
-I know that there are other ways around this like creating an XLM table to store values but think that might be too much overhead.
-If I cannot do something like what is below I will have to write a line for each propertry I want to retrieve.
-If I simply copy(not sure how to do this, I dont want to keep running the query) the object I will not be able to see a list of available properties in my IDE.:
Any comments or help?
<br />
Class MyClass<br />
{<br />
private string cn;<br />
private string sn;<br />
<br />
public void GetADObjectInfo(string dn)<br />
{<br />
DirectoryEntry entry = new DirectoryEntry("LDAP://"+ dn);<br />
foreach (string strAttrName in entry.Properties.PropertyNames)<br />
{<br />
try<br />
{<br />
this.strAttrName = (string)result.Properties[strAttName][0]; }<br />
catch<br />
{<br />
}<br />
}<br />
}<br />
}<br />
with Regards,
shwa guy
|
|
|
|
|
<br />
public class MyClass<br />
{<br />
private readonly Dictionary<string, string> properties = new Dictionary<string, string>();<br />
<br />
public string this[string name]<br />
{<br />
get { return properties[name]; }<br />
set<br />
{<br />
if (properties.ContainsKey(name))<br />
properties[name] = value;<br />
else<br />
properties.Add(name, value);<br />
}<br />
}<br />
<br />
public void GetADObjectInfo(string dn)<br />
{<br />
DirectoryEntry entry = new DirectoryEntry("LDAP://" + dn);<br />
<br />
foreach (string strAttrName in entry.Properties.PropertyNames)<br />
{<br />
this[strAttrName] = entry.Properties[strAttrName][0] as string;<br />
}<br />
}<br />
}<br />
Then access it like:
<br />
string myString = MyClass["PropertyName"];<br />
But you can't get it strongly typed (MyClass.PropertyName) without doing it one at a time I think.
|
|
|
|
|
I have an application that uses C# as the script language. The C# is compiled on the fly from within the application and executed.
I would like to be able to allow the user to debug their C# code from within my application.
I read an article somewhere on this a year or two ago and I can't fint it any more and I can't remember where.
I remember that it was just a slight variation on the standard CodeDom Compile-Load sequence. Searched MSDN and several other sites, but no luck.
Anyone know the answer?
|
|
|
|
|
This[^] might help you with some information.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
This[^] forum is also interesting.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks, the article does not apply, but the forum looks interesting.
|
|
|
|
|
When I bind a Datagrid to an arraylist (the items are strings), only one column
appears and it only shows me the lengths of the strings
Can anyone help me?
Thanks
-- modified at 14:41 Wednesday 31st October, 2007
After reading this message you will realize that you have wasted 5 seconds of your life
|
|
|
|
|
Use List<string> instead.
|
|
|
|
|
Thanks, but I need to use the Arraylist
Have you tried binding an arraylist to a datagrid?
I am using Microsoft Visual Studio 7.1
Thanks for the reply
|
|
|
|
|
How Can I Guarantee that my Application, upon its startup, Always Comes to Front and Has Input Focus no matter which application is currently having the Focus.
My MainForm is BorderLess, Maximized
Thanks...
|
|
|
|
|
Set the Topmost property to true.
|
|
|
|
|
Hi,
My Table
Column A Column B Columns C
Apple Apple Apricot
Pear Grape Peach
Grape Apricot
Banana
turn a datatable for below table With SQL (ColumA+ColumnB+ColumnC)
Apple 2 Unit
Pear 1 Unit
Grape 2 Unit
Banana 1 Unit
Aoricot 1 Unit
Peach 1 Unit
I want to turn a datatable with SQL this table.
Help me please, Thanks..
|
|
|
|
|
Write a query that:
1. Uses the UNION operator to concatenate the data in columns A, B & C into 1 column.
2. Uses the GROUP BY clause and COUNT aggregate function to count the instances of each fruit.
Hope this helps.
Paul Marfleet
|
|
|
|
|
Hello to all.
I guess I don't really understand how things(especially threads).
I have a function that runs in a separate thread then the rest of my application.
in the end of the function I print to a messageBox info I need for debugging.
the problem is I get to the messageBox twice.
the function is:
private void checkProblematicValves()
{
int dCount = 0;
int numMessagesLost = 0;
if (valveCheckedListBox.InvokeRequired)
{
checkProblematicValvesHendler d = new checkProblematicValvesHendler(checkProblematicValves);
valveCheckedListBox.Invoke(d);
}
else
{
foreach (long key in messageArr.Keys)
{
if (messageArr[key] != null)
{
doing some stuff here!!!!!!!!!!!!!!
}
}
}
MessageBox.Show(numMessagesLost.ToString());
}
I get to this "MessageBox.Show(numMessagesLost.ToString());" line twice, once with a true value
that prints to messageBox and right after I return to the same spot and it prints 0;
Can any one explain to me how come????
thanks in advanced.
|
|
|
|
|
Sorry for the stupid question, I realized my problem
|
|
|
|
|
So you want to test MessageBox on every thread you run?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello,
Any idea to create a synchronisation beetween processes running on 2 (or more) computers, as a semaphore IPC ?
Someone suggests me :
- locking record in an SQL database
- file on a shared filesystem
What else ?
Thanxs
/SGA
|
|
|
|
|
SGAYET wrote: create a synchronisation beetween processes running on 2 (or more) computers
synchronize what? Perhaps I'm wrong but that seems significant to me.
|
|
|
|
|
I need a mutual exclusion beetween processes running on different computers.
Explanation :
I have a program querying web services. It is running on 2 computers for load balancing and fault tolerance. The 2 processes are doing the same things, so i need to ensure anything done by one is not redo by the second.
Thanxs
|
|
|
|
|
Wow. That is not an explanation.
- "doing the same thing"
- "querying web services"
What things, why, when, how? How does the process know what to do?
SGAYET wrote: It is running on 2 computers for load balancing
What is doing the balancing?
|
|
|
|