 |
|
สอบถามปัญหาค่ะ หามาหลายวันละ งง SQL Error "Invalid object name" ผู้รู้ช่วยด้วยค่ะ |
|
 |
|
|
 |
 |
|

เราจะใส่เลขที่ Invoice จากนั้นคลิกเลือก ค้นหา มันก้ขึ้น Error ค่ะ
รูปแบบคำสั่งค่ะ
Code (VB.NET)
connIMCL = New SqlConnection
With connIMCL
If .State = ConnectionState.Open Then .Close()
.ConnectionString = ConfigurationSettings.AppSettings("connIMCL")
.Open()
End With
sqlCmd = "Select UserName,StatusLevel From CHECK_POLICY Where Program ='Purchasing' AND UserName = '" & Session("Usr") & "'"
sqlCmd = "SELECT PODATE, PONO, POLINENO, DISCRIPTION, OTYORD, UOM, PRICE, CURRCODE, SUPPLIER_NAME, RECDATE, QTYREC, INVNo, DEPARTMENT "
sqlCmd &= " FROM GRN_PO"
sqlCmd &= " WHERE (INVNo = '" & tINVNo.Text & "' )"
Cmd = New SqlCommand
With Cmd
.CommandType = CommandType.Text
.CommandText = sqlCmd
.Connection = connIMCL
.ExecuteNonQuery()
End With
da = New SqlDataAdapter(sqlCmd, connIMCL)
ds = New DataSet
da.Fill(ds, "GRN_PO")
dvm = New DataViewManager
dvm.DataSet = ds
dvs = dvm.DataViewSettings("GRN_PO")
With grdINVNo
.Visible = True
.DataSource = dvm.DataSet
.DataMember = "GRN_PO"
.DataBind()
End With
If ds.Tables("GRN_PO").Rows.Count = 0 Then
lMess.Text = "No InvoiceNo. in this P/O or incorrect InvoiceNo.!!!"
lMess.Visible = True
Exit Sub
End If
End Sub
**************************************************
Error ที่เกิดค่ะ
Code
Server Error in '/IMCL' Application.
--------------------------------------------------------------------------------
[font=Verdana]Invalid object name 'GRN_PO'. [/font] Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'GRN_PO'.
Source Error:
Line 227: .CommandText = sqlCmd
Line 228: .Connection = connIMCL
Line 229: .ExecuteNonQuery()
Line 230:
Line 231: End With
Source File: c:\inetpub\wwwroot\IMCL\AddGRN.aspx.vb Line: 229
Stack Trace:
[SqlException: Invalid object name 'GRN_PO'.]
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
IMCL.AddGRN.bSearchIn_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\IMCL\AddGRN.aspx.vb:229
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
รบกวนคำแนะนำด้วยค่ะ
Tag : .NET, VS 2003 (.NET 1.1)
|
|
 |
 |
 |
 |
Date :
2011-06-27 11:50:05 |
By :
AnnAnt |
View :
7086 |
Reply :
7 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Error ก็แจ้งแล้วน่ะครับ ไม่รู้จัก Table/View GRN_PO
|
 |
 |
 |
 |
Date :
2011-06-27 12:52:02 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นั่นแหละกะ ที่งง...และเปงปัญหา
เพราะเรามี Table ที่ชื่อ GRN_PO อะกะ
|
 |
 |
 |
 |
Date :
2011-06-27 13:28:40 |
By :
AnnAnt |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ดู Connection String หน่อยครับ
|
 |
 |
 |
 |
Date :
2011-06-27 13:34:13 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Imports System.Data
Imports System.Data.Odbc
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class AddGRN
Inherits System.Web.UI.Page
Dim sqlCmd As String
Dim connIMCL As SqlConnection
Dim Cmd As SqlCommand
Dim daCms As OdbcDataAdapter
Dim da As SqlDataAdapter
Dim ds As DataSet
Dim dt As DataTable
Dim dvm As DataViewManager
ขอบคุณค่ะ....
|
 |
 |
 |
 |
Date :
2011-06-27 13:59:08 |
By :
AnnAnt |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ConnectionString น่ะครับ
|
 |
 |
 |
 |
Date :
2011-06-27 14:17:11 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รันออกแล้วค่ะ...ขอยคุณมากค่ะ ...
ปัญหาคือ มัน connect ไปยังอีก Database อีกตัว
ขอบคุณค่ะ สำหรับคำแนะนำ.....
|
 |
 |
 |
 |
Date :
2011-06-28 08:29:47 |
By :
AnnAnt |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าเรียกและมั่นใจถุกต้อง ลองดูพวกเรื่องสิทธิ์ของ Table ด้วยครับ 
|
 |
 |
 |
 |
Date :
2011-06-30 19:13:09 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|