我在连接SQL base和c#代码时遇到问题。我已经完成了数据库,并尝试显示我的列是否可见,在visual studio中没有任何问题,警告,消息,但我无法从我的基础看到数据。这是非常简单的数据库。我用这些教程来做这个连接:https://www.youtube.com/watch?v=p2UeT7dBTEg]但是,我已经创建了一个数据库。这是程序的SQL连接部分:
public partial class MainWindow : Window
{
SqlConnection connection;
string connectionString;
public MainWindow()
{
InitializeComponent();
connectionString = ConfigurationManager.ConnectionStrings["projekt1.Properties.Settings.Database1ConnectionString"].ConnectionString;
}
private void MainWindow_Load(object sender, EventArgs e)
{
DisplayBMI();
}
private void DisplayBMI()
{
using (connection = new SqlConnection(connectionString))
using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Table ", connection))
{
DataTable tabelabmi = new DataTable();
adapter.Fill(tabelabmi);
listbmi.DisplayMemberPath = "bmi";
listbmi.SelectedValue = "Id";
listbmi.ItemsSource = tabelabmi.DefaultView;
}
}
答案 0 :(得分:0)
function sum(a) {
// what should here?
}
sum(1)(2) // should return 3