小编adL*_*adL的帖子

编译器错误消息:CS1519:类,结构或接口成员声明中的标记'='无效

我一直遇到以下编译错误:

            Compilation Error

            Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

            Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration

            Source Error:


              Line 22:              
              Line 23:  //Assign a Connection String
              Line 24:  conn.ConnectionString = ConfigurationManager.ConnectionStrings["sauceatronConnString"].ConnectionString;
              Line 25:          
              Line 26:  //Connection Open   

              Source Line: 24 
Run Code Online (Sandbox Code Playgroud)

只想在一般情况下以及在ASP和C#中编写新的编程.我以前使用相同的代码连接到数据库,它工作正常,但现在我得到的错误,我不太熟悉如何解决.下面是我的aspx页面和我的web.config的代码.

            <%@Page Language="C#" MasterPageFile="MasterPage/AtronsSiteMaster.master"%>
            <%@ Import Namespace="System.Data"%>
            <%@ Import Namespace="System.Data.Common"%>
            <%@ …
Run Code Online (Sandbox Code Playgroud)

c# database asp.net

3
推荐指数
2
解决办法
1万
查看次数

计算单个特定值在列中出现的次数

我正在写一个ASP.NET页面.我正在尝试编写一个查询来获取列中存在特定值的总次数:

课程表:

CourseSubject
--------------
ECT
HCI
HCI
Run Code Online (Sandbox Code Playgroud)

我只想返回name2出现的次数.

到目前为止我有这个但是一直出错:

comm.CommandText = "SELECT CourseSubject, COUNT(*) AS ETC FROM Courses;
Run Code Online (Sandbox Code Playgroud)

c# sql

0
推荐指数
1
解决办法
406
查看次数

输入字符串的格式不正确.param.Value = Int32.Parse(shipZipCodeTxt.Text);

我一直收到输入字符串格式不正确的错误.我不明白为什么会这样.我正在尝试写入我的数据库,而Zip代码是一个数字.我已经尝试将其更改为字符串,但这会导致在执行非查询时缺少参数.

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error: 


Line 130:               param.DbType = DbType.Int32;
Line 131:               param.Direction = ParameterDirection.Input;
Line 132:               param.Value = Int32.Parse(shipZipCodeTxt.Text);
Line 133:                       
Line 134:               comm.Parameters.Add(param); 

Source File:     Line: 132 

Stack Trace: 


[FormatException: …
Run Code Online (Sandbox Code Playgroud)

c# database asp.net

-1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×3

asp.net ×2

database ×2

sql ×1