|
Hi.
How can I link DBase III files in SQL Server? (Linked Server)
|
|
|
|
|
Try the SQL forum, you'll probably get a better response there. They may requires a SQL version to help. I was under the impression you could use the jet driver to get at DBase file, oh sh;t dbase III - good luck.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How to kill Remoting client or Server Object Object ofter use Please Help Me.
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Hello,
Is it possible to get as parameter a string and accordingly to call to the function that have the same name, without using cases but with some casting or something similar?
For example
'fName value passed to the function is for example "MyFunctionToBeCalled"
private sub LoadData(fName as string)
call "casting"(fName)
end sub
private function MyFunctionToBeCalled()
'DoSomething
end function
Thank you
Shay Noy
|
|
|
|
|
You can do this with reflection, but is seems nasty to me.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you, I will check this.
Actually, I have in database a list of users that I am sending to them an email (everyone get a different email) according to multiple criterias. Each criterias return information and this information is returned by different functions that are in my code.
So, I have a table in my database that define for each user which functions to pull out information and then this is the reason that I need to call a function according to the string I get from the database.
This is the best way I found to accomplish this task.
Any supposition?
Thank you
Shay Noy
|
|
|
|
|
I think you need an enum that defines the different possible criteria, and one method that takes this enum and returns the data asked for
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The problem is that the criteria are created dynamically. I have an interface that build criterias and for each criteria link to all the users that will get an email according to it. This interface is the trigger to fill my database.
If i will use enum, I will have to update my code every new criteria instead of adding new record(s) to my database.
The method you are suggesting to write, if I understood right, will include a select case of the enum items and each case will call to the according function.Why do not do this directly from the database, getting the method name (as string), use reflection (as you said) and then call to the function?
Thank you for your replies.
Shay Noy
|
|
|
|
|
But, if you add criteria, you need to write new methods to call in order to get the data you want anyhow, right ? If the data comes from a method that already exists, then you can use an enum value that already exists.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You are right.
I trying to reproduce all the scenario how it will work but I still have a problem in this way because also in your way I will need to use reflection.
This is the scenario:
I have an enum:
public enum criterias
criteria1
criteria2
criteria3 ...
end enum
From my database I need to know for each user which criteria is linked to.
My database example:
Col1: UserID {1,2,3,4}
Col2: Criteria (Criteria1,Criteria2,Criteria1,Criteria3}
Public function f()
'returns for each user wich criteria
criteriaFromDb=LoadCriteriaFromDb
select case criteriaFromDb
case criterias.criteria1
call f1
case criterias.criteria2
call f2
case criterias.criteria3
call f3
end case
end function
If I am right until this line, so criteriaFromDb is a string that I pull out from Mydatabase and now I still need to "convert" it to enum (I know how to do this) and it is actually same as "converting" string to function.
Thanks
Shay Noy
|
|
|
|
|
shaynoy wrote: I still need to "convert" it to enum (I know how to do this) and it is actually same as "converting" string to function.
Not at all. You make sure your enum has int values that correspond to the int values stored in your DB, and you just cast it. No reflection needed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Now it is clear, thank you very much
Shay Noy
|
|
|
|
|
I have used delegate functions for something like this, the database actually holds the method name but the methos must have the same footprint. I'll see if I can find the code tomorrow.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I'm having a problem with a contextmenustrip control. This menu appears when the user is right clicking on a control. When the click event of a first-level contextmenu item is called, I can use the sourcecontrol property in order to retrieve the control that has been clicked. However, when I the click event of a second-level contextmenu item is called, the program is not able to retrieve the right control. The program crashes and give me the following error: System.NullReferenceException.
Any help is welcome.
Gabriel
|
|
|
|
|
Hi,
i've a problem with string evaluation.
I need a function that return me the value of a variable passed throught his name...something like this:
<br />
Public Variable As Integer = 2<br />
<br />
<br />
Function Evaluate(ByVal name as String)<br />
End Function<br />
<br />
Evaluate("Variable") -> this have to return me the value 2<br />
Thanks
|
|
|
|
|
Function Evaluate(ByVal name as String) as Int32<br />
try<br />
return convert.toInt32(name)<br />
ctach ex as exception<br />
return 0<br />
end try<br />
End Function
Ashish Sehajpal
|
|
|
|
|
thanks!
Another question, if i want to process also String variable like this:
Public Variable as String = "abcd"
Evaluate("Variable") -> this must return abcd
Thanks
|
|
|
|
|
If I understood right, you say that passing as parameter the name of the variable to the function and converting it to int32 will return its value?
It is wrong or I perhaps miss something. Do you mean that this following code is running? Otherwise, please show your code.
Public Variable As Integer = 2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(Evaluate("Variable"))
End Sub
Function Evaluate(ByVal name As String) As Int32
Try
Return convert.toInt32(name)
Catch ex As Exception
Return 0
End Try
End Function
Shay Noy
|
|
|
|
|
First, ask yourself why you want to do this.
If you need to maintain a disperate group of variable values by name then perhaps you should use a dictionary, i.e.
Dim myVariables As New Dictionary(Of String, Object)()
myVariables.Add("myVarName", 2)
...
Dim i As Integer = DirectCast(myVariables("myVarName"), Integer)
If you really need to maintain class level fields then you'll have to use reflection to access the values dynamically, and you'll need a reference to the encapsulating class.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Hi there,
i have a little issue with form deactivation:
i use 3 forms: background form (form1), image form (form2) and list form (form3). i want to hide these forms when the background form (form1) gets deactivated but not when it gets deactivated by the other 2 forms.
that's how i start my application:
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
form2.show(Me)<br />
form3.show(Me)<br />
End Sub<br />
can anyone tell me a solution?
Thanks a lot.
|
|
|
|
|
your going to have to use a form manager(make your own) where you make calls into it via the activate/deactivate events of each form. then depending on who activate/deactivated show and hide form2 and 3...
hope this helps
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
How do I set the caret position in a textbox?
|
|
|
|
|
textbox.selectionstart/textbox.selectionlength
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Hi ..
Im looking for work out a way i can do math calculations in reportviewer. i've had a bit of a play and google somewhat but i think ill need someone to really tell it to me straight.
basically im looking to say do math caculation between to fields that the reportviewer generates.
so basically
col1 col2 col3 [calc amouts]<--- these column needs to calc all
10 5 15
20 10 45
30 15 90
i want col3 to continually do sums for each row without resetting
its previous amount.
hope this is clear some what..
thanks
Regards
Robbo
|
|
|
|
|
hi there..
i assume that u know how to use formula field.
so i'l gonna solve your problem as:
use a variable which stores the value of the previous row result and then add this variable to the sum of the current row result.
i hope you got it..!
J A Nasir K
|
|
|
|