-2

“不支持关键字:'pdata source”是什么意思。我正在努力找出问题所在?

        InitializeComponent();
        connString = "PData    Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\andrew\\Documents\\Vinyl0.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
        query = "SELECT * FROM Record";
        dAdapter = new SqlDataAdapter(query, connString);
        dTable = new DataTable();
        cBuilder = new SqlCommandBuilder(dAdapter);
        cBuilder.QuotePrefix = "[";
        cBuilder.QuoteSuffix = "]";
        myDataView = dTable.DefaultView;
        dAdapter.Fill(dTable);
        BindingSource bndSource = new BindingSource();
        bndSource.DataSource = dTable;
        this.dataGridView1.DataSource = bndSource;
        for (int q = 0; q <= dataGridView1.ColumnCount - 1; q++)
        {
4

3 回答 3

1

您的连接字符串有错字。它应该是

connString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\andrew\\Documents\\Vinyl0.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
              ^-----  not "PData    Source"
于 2013-05-02T15:39:53.283 回答
1

您的连接字符串不正确。

更改PData SourceData SourceorServer应该没问题。

请参阅这篇构建连接字符串文章和这篇文章,以了解基于您的版本/数据适配器的连接字符串的构造。

于 2013-05-02T15:40:32.887 回答
0

看起来你SqlDataAdapter不认识这个PData领域。

而且我也不认识它,您是否尝试过摆脱说的部分PData

于 2013-05-02T15:40:28.713 回答