我们正在使用 C# 和 ASP.Net 网络表单在 Visual Studio 2010 中创建站点。我们不知道为什么它在在线教程之后出现故障和出错,在修复其他问题后,代码出现了这个错误,我不知道如何修复它或者我做错了什么,如果有人能看到问题,请让我知道。
using System;
using System.Collections;
using System.Configuration;
using System.Data.SqlClient;
public class ConnectionClass
{
private SqlConnection conn;
private SqlCommand command;
ConnectionClass()
{
string connectionString = ConfigurationManager.ConnectionStrings["Connection"].ToString();
conn = new SqlConnection(connectionString);
command = new SqlCommand("", conn);
}
private ArrayList GetClothesByType(string ClothesType)
{
ArrayList list = new ArrayList();
string query = string.Format("SELECT * FROM fusey WHERE type LIKE '{0}'", ClothesType);
try
{
conn.Open();
command.CommandText = query;
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
int id = reader.GetInt32(0);
string name = reader.GetString(1);
string type = reader.GetString(2);
double price = reader.GetDouble(3);
string size = reader.GetString(4);
string image = reader.GetString(5);
string review = reader.GetString(6);
Fusey fusey = new Fusey(id, name, type, price, size, image, review);
list.Add(fusey);
}
}
finally
{
conn.Close();
}
return list;
}
internal static ArrayList GetClothesByType(object ClothesType)
{
throw new NotImplementedException();
}
}