''*'附近的语法不正确。' [关闭]

问题描述 投票:-3回答:1

这基本上是代码

string query = $"SELCET * FROM [Purchase] WHERE UserID = {userID} AND ProductSerialNumber = {productSerialNum}";
            using(SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(query, connection);
                SqlDataReader reader = command.ExecuteReader();
                return reader.HasRows;
            }

而且是的,我只是试图运行它,在“ SqlDataReader reader = command.ExecuteReader();”中崩溃了。编辑:yh解决了

c# helper sql-server-express
1个回答
1
投票

您有错别字,而是写了SELCET而不是SELECT

© www.soinside.com 2019 - 2024. All rights reserved.