Error in this Code....

Results 1 to 2 of 2

Thread: Error in this Code....

  1. #1
    Join Date
    Dec 1969

    Default Error in this Code....

    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>&#060;%@ WebService language="C#" class="login" %&#062;<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=&#039;localhost&#039;; trusted_connection=true; Database=&#039;login&#039;";<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>

  2. #2
    Join Date
    Dec 1969

    Default RE: Error in this Code....

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts