Rank: Advanced Member Groups: Member
Joined: 11/2/2010 Posts: 38
|
when I called the function:
<System.Web.Services.WebMethod()> Public Shared Function item_selected(ByVal munit) As Integer Dim da As New OleDbDataAdapter Dim cmdSQL1 As OleDbCommand m_unit = munit SQL1 = "SELECT unit_id,code_id, code_desc FROM cpms.code_vw where unit_id= '" & m_unit & "' " SQL1 = SQL1 & "and code_type != 2 " cmdSQL1 = New OleDbCommand(SQL1, ConnDB) da.SelectCommand = cmdSQL1 ds_po.Clear() da.Fill(ds_po) Grid2.DataSource = ds_po.Tables(0) Grid2.DataBind() End Function
I get an error message:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
that is happened at the line: Grid2.DataSource = ds_po.Tables(0)
would you tell me how to solve it. thanks
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We do not view this as a question related to our product because it's a compiler error that you can run into with or without our product. We consider such questions as general program questions thus they are beyond the scope of our support. Sorry about that!
Thanks!
|