简体   繁体   English

“CS1026:)预期”

[英]"CS1026: ) expected"

using (SqlCommand cmd = new SqlCommand("ReportViewTable", cnx) 
  { CommandType = CommandType.StoredProcedure })

When I try to open this page in the browser I am getting the当我尝试在浏览器中打开此页面时,我得到了

CS1026: ) expected error CS1026:) 预期错误

on this line, but I don't see where it's throwing the error.在这条线上,但我看不到它在哪里抛出错误。 I have read that an ;我读过一个; can cause this issue, but I don't have any of them.可能会导致这个问题,但我没有。

I can help with any additional information needed, but I honestly don't know what question I need to ask.我可以提供所需的任何其他信息,但老实说我不知道我需要问什么问题。 I am trying to google some answers on this, but most of them deal with an extra semicolon, which I don't have.我试图用谷歌搜索一些关于这个的答案,但其中大部分都涉及一个额外的分号,而我没有。

Any help is appreciated.任何帮助表示赞赏。 Thank you.谢谢。

If this is .NET 2.0, as your tags suggest, you cannot use the object initializer syntax.如果这是 .NET 2.0,正如您的标签所暗示的那样,您不能使用 object 初始化语法。 That wasn't added to the language until C# 3.0.直到 C# 3.0 才将其添加到语言中。

Thus, statements like this:因此,像这样的语句:

SqlCommand cmd = new SqlCommand("ReportViewTable", cnx) 
{ 
    CommandType = CommandType.StoredProcedure 
};

Will need to be refactored to this:将需要重构为:

SqlCommand cmd = new SqlCommand("ReportViewTable", cnx);
cmd.CommandType = CommandType.StoredProcedure;

Your using -statement can be refactored like so:您的using -语句可以像这样重构:

using (SqlCommand cmd = new SqlCommand("ReportViewTable", cnx))
{
    cmd.CommandType = CommandType.StoredProcedure;
    // etc...
}

You meant this:你的意思是:

using (SqlCommand cmd = new SqlCommand("ReportViewTable", cnx)) { cmd.CommandType = CommandType.StoredProcedure; }

Addition to ioden answers:除了ioden答案:

Breaking code in multiple lines,打破多行代码,
then double click on error message in compile result should redirect to exact location然后双击编译结果中的错误消息应该重定向到确切位置

something like:就像是:

在此处输入图像描述

im have the cs1026 issue look my code我有 cs1026 问题看我的代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
int angulo;
Quaternion rotacao;
public class interacao : MonoBehaviour
{
    bool interagivel;
    public GameObject porta;
    public Camera cam;
    public Text texto;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        rotacao=Quaternion.Euler(0, angulo, 0);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotacao, Time.deltaTime * 5);
        if(interagivel == true)
        {
            if(Input.GetKeyDown(KeyCode.E))
            {
                
                if(angulo == 90);
                {
                    angulo = 0;
                } // <--error
                else
                {
                    angulo = 90;
                }
            }
        }

        RaycastHit hit;
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        if(Physics.Raycast(ray, out hit, 15))
        {
              if(hit.collider.transform == porta.transform)
              {

              }
        {

            if(hit.distance <= 3)
            {
                texto.text = "Pressione [E] para interagir";
                interagivel = true;
            }
            else
            {
                texto.text = "";
                interagivel = false;
        }
        else //<-- error
        {
            texto.text = "";
            interagivel = false;
        }

        }
    }
}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM