Author |
Topic |
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-05-11 : 10:12:47
|
Hi allI have a function, in which i am supplying a datatable, and one of its row as argumentseg: private function Select(byval dt as datatable, byval specification as string)here specification is the name of the row of dt-- the function works fine, and result i am gettingProblem is that, i want to use the same fucntion, somewhere elese, where the datatable row has the name "company name" ie, its two wordHow can i give in the function likeprivate function Select(byval testdt as datatable, byval "company name" as string)I am confused, as i am not able to change the row name also, now(as it affects many parte)Please someone help me to fix thisThank you |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-11 : 10:18:45
|
I have no idea what you are asking ... can you please try re-phrasing your question maybe, or providing an example?You know that if a function has this definition:private function Select(dt as datatable, name as string)you can call it like this:Select(yourdatatable, "company name") right ? A string can contain more than 1 word. Is that what you are asking?- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-05-11 : 10:26:15
|
You are correct, i can call the function like that.What i was asking was when i use the function in another page, i want to define it.So there i want to change the function signature little bitFirst one is private function Select(dt as datatable, name as string)-- worksIn the second page, i want to write the definition of function asprivate function Select(dt as datatable, "compnay name" as string)I was asking can i give exactly the same name of the row "Company name" within the argument section of function signature??I am sorry if i am confusing.Thanks for your support |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2007-05-11 : 10:27:53
|
The column name property in a DataColumn in a DataTable can have a space in them. So if you simply pass "company name" in your function, as long as you have a DataColumn in your DataTable with that name, it should be able to find that DataColumn and return the value you need.SQL Server Helperhttp://www.sql-server-helper.com |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-11 : 10:32:03
|
I'm sorry, I still have no idea what you are asking. Do you want "company name" to be the DEFAULT value for that argument? If so, then you write it like this:private function Select(dt as datatable, optional byval name as string = "company name")also -- If you have a function on one page, and you want to call that function from ANOTHER page, then that means the function does not belong on a page at all. It should be stored in a module or class that both pages can use. One page should never call code from another page (maybe not never, but it is very rare that this would be a good idea).As always, my simple advice (which people really hate) is this: get a good book on beginning ASP.NET and read it ... or at least skim it. Sounds like you could use a good overview of the basics of asp.net and also vb.net. That's how I learned. .NET is a HUGE difference from vb6 or scripting in SQL or javascript/vbscript -- it is very important to understand object oriented programming concepts.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-05-11 : 10:33:47
|
Thanks very much for poiting out meI got it fixed.Dont know how can i improve my programming abilityThanks |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-11 : 10:36:07
|
quote: Originally posted by reflex2dotnetDont know how can i improve my programming ability
Again, simply read a book? Why is this suggestion so crazy to people? try it. You might like it and even maybe ENJOY it! you can read a book on the beach, in bed, on the couch, at the park. it's nice to get away from a computer and brush up on the core concepts. Just try it. even libraries often have good books for FREE that you can read about programming.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-05-11 : 10:43:35
|
Thank you very much for your sincere advise.Will try on that!! |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 11:00:05
|
quote: you can read a book on the beach, in bed, on the couch, at the park...
... on the toilet _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 11:17:47
|
you don't read on the toilet??? weirdo..._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 11:22:25
|
no? how come?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
|