Hi I have setup a function as below. The calling code is <tr><td> <%=CreateDisplay(2009, 4, 10, 750, 0, 5760, 10, 'N', 'x', [email protected], 'QV')%></td></tr> The message when selecting CreateDisplay with the mouse is 'createdisplay not declared. It may be inaccessible due to its protection level' CreateDisplay should build an SQl query and return the resultant data. Any help would be appreciated. Michael Public Class DatabaseAccess Public Shared Function CreateDisplay(ByVal RequiredYear As Integer, ByVal RequiredWeek As Integer, ByVal RequiredGrouping As Integer, RequiredCategory As Integer, ByVal ItemRequired As Integer, ByVal strProgramID As Integer, RequiredBlock As Integer, ByVal SpecRequired As String, ByVal CustomerEmail As String, ByVal Reign As String) ----------- setup parameters ---------- Return strSQL End Function End Class
a couple of things: in the call to the function, the parameters are either strings or integers. Therefore, a hyperlink should be passed as a string. where do you define your function? they are either in the -code behind- (or -code beside-) file, or in the webpage itself in a script block <script runat="server"> YOUR FUNCTION HERE </script> what material are you using to learn this stuff, other than posting here? [posting has to be the slowest way]
hi Peter This called routine is fairly large large and complex and is used by around 30 different programs in this website. It looked like I could put the code in the Public Class DatabaseAccess as a Public Shared Function and use it from each of these programs. Yes, I am using a book (asp.net 3.5 in 24 hours - chosen because the hosting is 3.5) and searching the web for answers. I have done a lot of programming over the years (vb, classic asp, cobol) but have had no experience of .net until a couple of weeks ago!
ah yes, that is the third place functions can reside; in /App_Code. ASP.NET allows procedures that have the same name, but different signatures. So instead of telling you that your parameter string is in error, it says it’s looking for a signature that matches the parameter string you wrote, but can’t find one. Fix your parameter string to match the function call you want, and you’re in business.