|
|
pls try the below code:
private void frmPublic_Load(object sender, System.EventArgs e)
{
int myGetID;
Form1 myGetForm1 = new Form1();
myGetForm1.btnOK_Click(null,null); //init ur variable in form1
int myGetID= myGetForm1.GetID; //assign here
....
}
<< >>
|
|
|
|
|
This is really crappy advice, sorry. If he wants to pass an ID, he should just pass the ID, not an entire form instance, which would also mean having to make the variable public.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes u are right, Christian.
this is really stuppid.
Thanx
|
|
|
|
|
dear,Friends!
Be Patient in all over your life!life is difficult ,special more difficult for us because we are a beginner in c# .
in any case ,finally ,I found the following way for solve my problem :
----------------
in Form2:
....
public class Form2:...
{
....
private static Form1 tofrmUsername;
public static Form1 TofrmUsername
{
get
{ return tofrmUsername; }
set
{ tofrmUsername = value;}
}
AND in Form1:
....
private int GetID;
....
public void btnOK_Click(object sender, System.EventArgs e)
{
....
GetID=Convert.ToInt32(UserTable.Rows[0][0]);
Form2.TofrmUsername = this;
....
}
....
public int Get_GetID
{
get { return GetID; }
}
And Finally In Form2_Load()
private void Form2_Load(object sender, System.EventArgs e)
{
Form1 mygetidForm= TofrmUsername;
int myGetID= mygetidForm.Get_GetID;
....
}
Thanks For Everything!
yours!
mostafa hosseiny b.
|
|
|
|
|
CPians glad to solve probs
<< >>
|
|
|
|
|
How to retrieve 100 records when joining 2 tables in a select statement?
Aarsth
|
|
|
|
|
SELECT TOP 100 t1.field1, t1.field2, t2.field2, t3,field3
from t1, t2
WHERE t1.field1 = t2.field2
ORDER BY t1.field1 DESC
The "SELECT top 100" is dependant on your ORDER BY. So you can order by "SALES DESC" and get the TOP 100 sales by customers.
another example: This will get top 100 customers by DESCending Year to Date sales.
SELECT TOP 100 Cust.CustID, Cust.Name, Sum(orders.order_value)
from orders, Cust
WHERE orders.CustID = Cust.CustID
AND YEAR(orders.date) = 2005
GROUP BY Cust.CustID, Cust.Name
ORDER BY Sum(orders.order_value) DESC
|
|
|
|
|
Hi,
I am using ODBC to look up information in a small table (approx 400 rows of columns AutoID(auto incrementing), ID(long passed on row addition), House_Num (text passed on row addition), Place_Name (text passed on row addition) and Reserve_Name (text also passed on row addition).
House_Num can be either a series of numbers or a letter/number combination. Adding all of the rows went fine.
I'm now trying to search the database to return the ID of a specific House_Num and Reserve_Name combination. Using CRecordset.m_strFilter I can find the all numbers House_Num, however every time I try and use a number/letter combination I get an undefined error and the program is killed.
It doesn't seem to matter if I separate the letters/numbers at all in the m_strFilter.
Does anyone have any ideas?
Thanks,
Drew Doering, Paramedic
|
|
|
|
|
Did you forget to put ' (apostrophe) between your number/letter combination?
Remember that you don't need apostrophe for numbers but you need apostrophe for number/letter combination.
[Edit]Could you please include a sample of the filter string?[/Edit]
Ed
|
|
|
|
|
Hi,
The m_strFilter code looks like this
Do a bunch of stuff, including open the database and declare recordset derived variable resRecset...<br />
UpdateData(TRUE);
resRecset.m_strFilter = "House_Num = '" + m_sHouseNum + "' AND Reserve_Name = '" + m_sReserveName + "'";
I'm just re-reading your answer now. Do you mean that for a combination of say ME1 or 104SD that I should pass ME'1 and 104'SD?
Thanks,
Drew
|
|
|
|
|
Drew wrote:
Do you mean that for a combination of say ME1 or 104SD that I should pass ME'1 and 104'SD?
No, no. I meant to put single apostrophe between the argument you're passing just like the way you did it.
Are you sure that the line throwing an error is within the record-accessing code? Because the query seems ok to me.
Try running your query in an Enterprise Manager / Query Analyzer or something similar.
If it runs, use TRY CATCH statement to see which part is returning an error. It may be that you're accessing the House_Num as number instead of string.
Ed
Signature
The only valid use of the BLINK tag: Schrodinger's cat is <blink>not dead .
|
|
|
|
|
SQLXML component from microsoft can convert XML data into relational data and load it into an existing SQL Server 2000 database tables. Is such facility available for Oracle database too? Can someone give me links?
Salil Khedkar [^]
|
|
|
|
|
|
Help me,
i have downloaded merge modules of cr9 as lisence.msm,mapping.msm etc. and i have included in my deployment project, but it my crystal reports still saying keycode.dll error. help me integrate the modules to keep the crystal report work on the client's system. and how to do so please help me.
FIRE On moon
|
|
|
|
|
|
Any pointers, suggestions, links, hints on making an enterprise app database independent... Thanks…
Salil Khedkar [^]
|
|
|
|
|
Have a look at the Data Provider model (DotNetNuke[^] has a good example).
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Hmmm... Thanks for the info... O/R mapper seems to be the keyword for this subject. I will read more...
Salil Khedkar [^]
|
|
|
|
|
There are OOP design patterns that allow you to completely decouple an application from various parts of it's implementation, including database implementation.
Basically you would define an abstract interface that describes database operations in a standard, high level, platform independent fashion. Then you use a pattern known as an Abstract Factory to create the classes that actually provide the platform specific database implementation.
Having said that, it;s easy to describe the concept, the implementation is another matter altogether.
I suggest you get a good book, or several that describe Design Patterns for the language you are using and be prepared to spend a lot of time studying and experimenting.
|
|
|
|
|
Hmmm... Thanks for the info man... Yup I am starting the study phase...
Salil Khedkar [^]
|
|
|
|
|
Can someone help me with this
InPatientId AdmissionDate ActualDischargeDate Days
Client-100027 22/02/2005 01/04/2005 39
Client-100027 09/06/2005 23/06/2005 15
I want show clients who came back within 40 days of last discharge(Second admissiondate(09/06/2005) check with first ActualDischargedate(01/04/2005)).
Can anyone tell me what else i need to add on to it.
SELECT Cut.InPatientId, Cut.AdmissionDate, Cut.ActualDischargeDate, DateDiff("d",[AdmissionDate],[ActualDischargeDate]+1) AS Days
FROM Cut
WHERE (((Cut.InPatientId) In (SELECT [InPatientId] FROM [Cut] As Tmp GROUP BY [InPatientId] HAVING Count(*)>1 )))
ORDER BY Cut.InPatientId, Cut.AdmissionDate, Cut.ActualDischargeDate;
|
|
|
|
|
Something like this,
SELECT *
from Cut, Cut as SecondCut
WHERE (Cut.InPatientId = SecondCut.InPatientId )
AND (SecondCut.AdmissionDate > Cut.AdmissionDate)
AND (DATEDIFF(dd, Cut.ActualDischargeDate, Secondcut.AdmissionDate ) < 40)
I've not checked this SQL as its "off the cuff" but you can get the idea.
|
|
|
|
|
I have a working database and a 'DetailView'. I've added a ListBox which is databound to the same dataset (it works too). But when I select an item off the ListBox, I would like the detailview to update to the selected item in the ListBox.
In otherwords, How do I set the CurrencyManager Index (?) to the ListBox.selectedIndex?
I'm using VB.Net 2005 (beta 2), which shields me from alot of the code I'm trying to figure out. In way of these new objects, I have: abindingSource, DataSet, bindingNavigator, and a TableAdapter. I'm not even sure which of these objects handles the currencyManager (or if any).
If someone can point me to an article or some code, I would greatly appreciate it. I'm lost.
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
I would use a datagrid to drive a second datagrid using "Item Command"
See my article on easy ADO, its in C# which can be translated in VB
http://www.codeproject.com/aspnet/EasyADODgrids.asp
|
|
|
|