Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public void Autostid()
{
DBaccess c = new DBaccess();
c.connect();
Autostid = c.Autonumber("stid", "tblstudent", "");
c.disconnect();
}

What I have tried:

am create code in dblayer then display Error: cannot assign to 'Autostid' because it is a 'method group' How to solve
Posted
Updated 28-Dec-17 0:26am

1 solution

Your method name is Autostid, and you're trying to assign something to Autostid. That isn't going to work. Give your variable a different name, and don't forget to either specify the type or put var in front of it:
C#
var result = c.Autonumber("stid", "tblstudent", "");


[Edit]

If Autonumber is a void (i.e. it doesn't return a value), you cannot assign it to a variable, and you have to call it like this:
C#
c.Autonumber("stid", "tblstudent", "");
That is, calling the method without assigning the result to a variable.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900