|
lankaudaranga wrote: this code work access databse but sql server 3.5 compact server notwork
What do you mean by "not work". Exactly, how does it not work? What is the error you get?
|
|
|
|
|
EROOR massege display "hasrow" not supports
|
|
|
|
|
You should had posted the full error description. Any hows do it this way
if(dr.Read())
{
//your code here
}
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
YES
reader.Read();
if (reader.HasRows == true)
{
MessageBox.Show("STOCK ID ALREADY EXITS", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
comboBox1.Text = "";
comboBox1.Focus();
}
BUT ITS NOT WORK
|
|
|
|
|
lankaudaranga wrote: reader.Read();
if (reader.HasRows == true)
NO! That is not what was told to you.
if(reader.Read())
{
}
|
|
|
|
|
i want to send data to database but data not duplicate(hasraw==true)
if (reader.HasRows == true)
{
//data already exite no data insert.display massege .....
}
else
{
enter data(insert data
}
{you undastand this)
|
|
|
|
|
Yes, I understand you. However, you don't seem to understand me.
To spell it out:
if (reader.Read())
{
}
else
{
}
So, as you can see, and as I explained earlier, you do not need HasRows .
|
|
|
|
|
Hi,
I'm trying a windows service that fetches the contents of the mails from my inbox and saves them in a database using IMAP protocol. I've fetched the contents of the mail body using the IMAP command "1 UID FETCH 756 BODY[1]\r\n", where 756 is message UID.
How can I fetch the attachments so that i can save the attachments in a specific location and i can use them later.
I've tried a lot to find this but i couldn't get. Few articles gave me an idea to fetch the attachments as an encoded file(Encoded in Base64 format), which i couldn't use.
further,
How does the attachments getting stored in the exchange server. Does it have a URL to access.
If so, is there a way to find the URL of the attachment being stored in the exchange server? So that I can fetch or download them to save it.
Thanks in advance,
Kathir
|
|
|
|
|
Hi,
I am in the process of creating the clickonce setup for an application I have developed.
The application requires .net 3.5 framework and windows installer.
In the pre-requisites of the publish properties, I would like to select Download prerequisites from the same location as my application.
Question:
Where exactly do I place these two files? Do I place them on the root or the bin, etc?...
Thanks
|
|
|
|
|
Bin
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Hey all i need help to make an application that can read text from specific location(a label designed by me) on an image. I am done with OCR part the problem i am facing is how i am gonna recognize the label, first i thought to put 2 circles on top corners on the label to identify them but i was unable to identify those circles too. So if anyone knows the solution please help me out.
|
|
|
|
|
Please, clearify your question
post some code
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Hi,
I have trouble trying to find out which instance of a MDI child is active and how to adress it's properties and methods.
I have got a MDI form with child frmList that shows all the available info in a particular case, then clicking on one of the nodes should pop up an frmShow that displays the info in a grid on a background image. Adding to this is a from frmProperties with certain tools that should depict what the user can do on the frmShow window (Be it zooming in, adding lines etc).
The problem is that there must allways just be one instance of frmList and frmProperties but multiple instances of frmShow. I think I have it sorted with: (make suggestions please !)
bool isOpen = false;
for (int x = 0; x < this.MdiChildren.Length; x++)
{
if (this.MdiChildren[x].Name == "frmListDef")
{
isOpen = true;
}
}
if (!isOpen)
{
Form frmList = new frmListDef();
frmList.MdiParent = this;
frmList.Show();
}
Now I am trying to find out how to adress a method or property on the specific instance of a child ?
thanks
Ian
PS: any nice articles or refs to MDI programming would be nice
|
|
|
|
|
If you want only one instance of a form to be open at a time use Singelton pattern
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
The problem with this approach is the MdiChildren property of the parent is an array of forms so you can only see the standard properties and methods of the Form class unless you cast each member of the array to the appropriate class. That can be done by the code below.
Assuming you have a class ChildForm1 : Form with a method DoSomething and property SomeProperty.
foreach (Form child in this.MdiChildren)
{
if (child is ChildForm1)
{
ChildForm1 theChild = (ChildForm1)child;
MessageBox.Show(theChild.SomeProperty);
theChild.DoSomething();
}
} This is going to get messy if you have many forms with many properties and methods and will difficult to maintain.
You could use reflection to get all the info about the child forms and their methods/properties but that may be a little slow depending on just how much reflection you need to do, but is probably the best solution here.
Have you thought about creating an interface that your all child forms can implement as well as deriving form Form? You could add all the properties and methods that will be available in the children to the interface and implement them on the appropriate forms. The ones that shouldn't implement a specific property or method could throw a NotImplementedException so you know it's not available.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Thanks Dave,
It works !! Do you know of a good reference on more MDI topics ? A step by step guide to get abit more out of my MDI code !
cheers
Ian
|
|
|
|
|
Not really - MDI is much the same as any other winforms app.
The only suggetions I would give are:
1. Get very familiar with events and delegates as inevitably you'll find the need to get your child forms communicating with their parent and siblings.
2. All your child forms are actually hosted in a container which is an instance of the MdiClient class. You may find sometimes it's useful to have access to that control. Creating this readonly property and member variable in your MdiParent will make this much easier.
private MdiClient m_MdiClient;
public MdiClient MdiClient
{
get
{
if (m_MdiClient != null)
return m_MdiClient;
foreach (Control control in Controls)
{
if (control is MdiClient)
{
m_MdiClient = (MdiClient)control;
return m_MdiClient;
}
}
throw new Exception("MdiClient control could not be found");
}
}
You then have access to all the containers properties, methods and events!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
I have one DataTable and one datagridview.
Both are hardcoded.
DataTable has been populated and now i want to bind this with DataGridView.
DGV.DataSource = datatable;
Above code is not working. This code is not giving any error but this code is not populating datagridview.
Is there any property for binding Hardcoded DGV.
Thanx in Advance.....
|
|
|
|
|
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.AutoGenerateColumns = true;
bindingSource1.DataSource = GetData("Select * From Products");
dataGridView1.DataSource = bindingSource1;
dataGridView1.AutoSizeRowsMode =
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
dataGridView1.BorderStyle = BorderStyle.Fixed3D;
dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Please decribe in details and give the souce code in both c# & vb.net , How to scan the image from web cam
|
|
|
|
|
|
I'm trying to wrap my head around using LINQ and lambda expressions in c# 3.0, and as such I threw together a short (presumably) simple exercise- A general function that will take an IEnumerable and return a concatonation of the string representations of each of the elements contained therein.
public String concat(ICollection values )
{
return values.Cast<object>().Aggregate((Object x, Object y) => x.ToString() + y.ToString());
}
However, when I try to run this little gem, I get the following:
"The type arguments for method 'System.Query.Sequence.Aggregate<t>, System.Query.Func<t,t,t>)' cannot be inferred from the usage. Try specifying the type arguments explicitly"
Googling revealed that this error is usually the result of saying (x,y) => ... instead of explicitly typing X and Y the way you would when defining the parameters in a method. Makes sense, except that I'm explicitly saying "(Object x, Object y)". Further, when I change all instances of "Object" to "String" (which I don't want to do for the final version, as I want this to work for any type of object), it works without a hitch. I don't understand why that makes a difference, since I'm calling ToString() on the object to get the string out, and "ToString()" works for any object. Is this a failing of the type inference system? Or am I just completely glossing over something?
Much appreciated.
|
|
|
|
|
public string concat(ICollection values)
{
return (string)values.Cast<object>().Aggregate((x, y) => x.ToString() + y.ToString());
}</object>
|
|
|
|
|
I'm still getting the "type arguments for method ... cannot be inferred from the usage" error. Even tried throwing gratuitious use of "Object" back in (Object x, Object y).
Thanks for the attempt, though.
|
|
|
|
|
Member 2148527 wrote: I'm still getting the "type arguments for method ... cannot be inferred from the usage" error. Even tried throwing gratuitious use of "Object" back in (Object x, Object y).
Thanks for the attempt, though.
Erm, the code as I pasted I compiled, so either you are missing something, or you are compiling in VS2005 maybe (or using the C# 2.0 compiler?)!
|
|
|
|