Error in this Code....

SystemOAD

New Member
When I am running this program it is giving me this error Does anyone know why I am getting this error.<BR>Thanks in advance <BR>Venky<BR>Microsoft (R) Visual C# .NET Compiler version 7.00.9466<BR><BR>Cosynelogin.asmx(25,25): error CS1513: } expected<BR>Cosynelogin.asmx(33,1): error CS1022: Type or namespace definition, or end-of-file expected<BR><BR><BR><%@ WebService language="C#" class="login" %><BR>using System;<BR>using System.Web.Services;<BR>using System.Xml.Serialization;<BR>using System.Data.SqlClient;<BR><BR>public class login {<BR><BR> [WebMethod]<BR> public String Add(String a, String b) {<BR> <BR> string connectionString = "server='localhost'; trusted_connection=true; Database='login'";<BR> SqlConnection sqlConnection = new SqlConnection(connectionString);<BR> <BR> string queryString = "SELECT [login].[username], [login].[password] FROM [login]";<BR> SqlCommand sqlCommand = new SqlCommand(queryString, sqlConnection);<BR> <BR> sqlConnection.Open();<BR> SqlDataReader dataReader = sqlCommand.ExecuteReader();<BR><BR> 25.Line while dataReader.Read()<BR> {<BR> if(a==dataReader("username") )<BR> return a;<BR> else<BR> return b;<BR> }<BR> }<BR>33 Line}<BR>25.Line while dataReader.Read()<BR><BR>should be<BR><BR><BR>while ( dataReader.Read() )<BR><BR><BR>in c and c# or any c style language the control blocks must have parens around them. not like vb.
 
Back
Top