I 테이블 열을 검색하는 C#에서 다음과 같은 코드를 가지고 :왜 SQL 테이블에서 SELECT 동안 오류가
protected void Page_Load(object sender, EventArgs e)
{
using (OleDbConnection connection = new OleDbConnection("Provider=MSDataShape;Data Provider=SQLOLEDB;" +
"Data Source=wmg-erp-db;Initial Catalog=DP;User ID=zh;Password=zhas"))
{
OleDbDataAdapter adapter = new OleDbDataAdapter("SHAPE {SELECT FROM [DP].[dbo].[BT]} ", connection);
DataSet customers = new DataSet();
adapter.Fill(customers, "Customers");
}
}
내가받을 다음과 같은 오류 :
Exception Details: System.Data.OleDb.OleDbException: Incorrect syntax near the keyword 'FROM'.
Source Error:
Line 35:
Line 36: DataSet customers = new DataSet();
Line 37: adapter.Fill(customers, "Customers");
Line 38: }
Line 39: }
Source File: c:\Webserver\WEXEC\Booking\booking.aspx.cs Line: 37
Stack Trace:
[OleDbException (0x80040e14): Incorrect syntax near the keyword 'FROM'.]
System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) +60
System.Data.OleDb.OleDbDataReader.NextResult() +630
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +546
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +264
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +9
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +325
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +280
booking.Page_Load(Object sender, EventArgs e) in c:\Webserver\EXEC\Booking\booking.aspx.cs:37
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
방법 문제를 해결할 수 있습니까?
에 대한
중 하나가 열 이름을 지정, 또는
*
. 'SHAPE * {DP [DES]. [dbo]. [BT]} '에서 선택하십시오. –DUH !!! 나는 그것을 간과했다. 감사. – SearchForKnowledge