Hello
In my Register.aspx.cs (a Web form for new users), I am getting the following error:
Compiler Error Message: CS1518: Expected class, delegate, enum, interface, or struct
The error refers to this line: public static string GetConnString()
In particular Visual Studio does not like 'string' in the above line which it has underlined in red.
How can I correct that, please?
Many thanks.
Steve HighamPosted Aug 28, 2014, 9:34 AM
Hello Vulpes
Thanks again for your help
I got a blue screen this morning and need to replace my hard drive and download Visual Studio again
As soon as I have done that - in the next 3-4 days - I will try out your script
Thanks again!
VulpesPosted Aug 28, 2014, 5:15 AM
If you put it in a class - Connection let's say - then the error should go away and you can call the static method with Connection.GetConnString().
Steve HighamPosted Aug 27, 2014, 8:16 PM
Thanks for your reply
Yes, I have this:
using Microsoft.AspNet.Identity;
using System;
using System.Linq;
using System.Web.UI;
using WebSite1;
public static string GetConnString()
Website1 is the name of the site itself
Thanks for looking at the code
VulpesPosted Aug 27, 2014, 7:19 PM
Steve HighamPosted Aug 27, 2014, 5:05 PM
Thanks, Dipankar
As recommended in the stackflow answer, I have changed the line to:
public static String GetConnString()
with a capital 'S' and even
public virtual String
but Visual Studio is still underling the words 'String'
Any other ideas what the problem might be?
Dipankar BiswasPosted Aug 27, 2014, 4:49 PM
http://stackoverflow.com/questions/21910568/cs1518-expected-class-delegate-enum-interface-or-struct