0
내 데이터베이스의 열에서 풍부한 텍스트 상자에 데이터를 표시하려고하는데 DataSet과 DataReader가 섞여 있습니다. 아래 코드의 대부분이 정확합니다. 오류가 포함 된 두 줄을 얻었습니다. 이유는 확실하지 않습니다.ADO.NET - 데이터 읽기 오류
// Create a connection string
string ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= C:\\Documents and Settings\\Harley\\Desktop\\Test.accdb");
string SQL = "SELECT * FROM Paragraph";
// create a connection object
SqlConnection conn = new SqlConnection(ConnectionString);
// Create a command object
SqlCommand cmd = new SqlCommand(SQL, conn);
conn.Open();
DataTable dt = new DataTable();
da.Fill(dt); //ERROR
// Call ExecuteReader to return a DataReader
SqlDataReader reader = cmd.ExecuteReader();
foreach(DataRow reader in dsRtn) //ERROR
{
richTextBox = richTextBox.Text + reader[0].ToString();
}
//Release resources
reader.Close();
conn.Close();
}
오류 메시지가 무엇입니까? –