By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,490 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,490 IT Pros & Developers. It's quick & easy.

Error when trying to run a stored procedure

P: n/a
I am getting this error when trying to run a stored
procedure:
[MissingMemberException: No default member found for
type 'DataSet'.]

Microsoft.VisualBasic.CompilerServices.LateBinding .LateInd
exGet(Object o, Object[] args, String[] paramnames) +1361
ASP.Baldwin41_aspx.Button1_Click(Object sender,
EventArgs e) +66
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+83

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEv
entHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

Here is my program

Function GetResults

Dim ConnString As String = "server='(local)'; user
id='sa'; password='fritz'; database='Cutis'"
Dim sproc As String = "EMSTONY"
Dim paramsize As Integer = (7)

Dim Conn As New SqlConnection(ConnString)
Dim cmd As New SqlCommand(sproc)
cmd.CommandType = CommandType.StoredProcedure

Dim param as New SqlParameter("@txtSort", DbType.String,
paramSize)
param.Value = txtSort.Text
cmd.Parameters.Add(param)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet("Dataset")
da.TableMappings.Add("Table", "DataGrid1")

Try
conn.Open()
da.Fill(ds)
Catch ex As Exception
'Error handling here
Finally
If (conn.State = ConnectionState.Open) Then
conn.Close()
End If

conn.Dispose()

End Try
Return (ds)

End Function

Sub Button1_Click(sender As Object, e As EventArgs)
DataGrid1.DataSource = GetResults(TxtSort)
DataGrid1.DataBind()
End Sub
Any HELP GREATLY APPRECIATED.
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Jeff,

Not too sure why you are getting this error. The code looks good. Anyway, i
just made a search for the error. This is what i find..

1. MissingMemberException is thrown when there is an attempt to dynamically
access a class member that does not exist.

2. Also suggest you turn Option Strict On. This will elminate these kinds of
problems at compile time, because your program will not compile.

The function calling SP looks fine. I think the problem exists
in the way you are binding the datasource to the datagrid in the button click
event. Can you check on it.

Need any help, do post a msg back...

Happy Coding

"Jeff Thur" wrote:
I am getting this error when trying to run a stored
procedure:
[MissingMemberException: No default member found for
type 'DataSet'.]

Microsoft.VisualBasic.CompilerServices.LateBinding .LateInd
exGet(Object o, Object[] args, String[] paramnames) +1361
ASP.Baldwin41_aspx.Button1_Click(Object sender,
EventArgs e) +66
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+83

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEv
entHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

Here is my program

Function GetResults

Dim ConnString As String = "server='(local)'; user
id='sa'; password='fritz'; database='Cutis'"
Dim sproc As String = "EMSTONY"
Dim paramsize As Integer = (7)

Dim Conn As New SqlConnection(ConnString)
Dim cmd As New SqlCommand(sproc)
cmd.CommandType = CommandType.StoredProcedure

Dim param as New SqlParameter("@txtSort", DbType.String,
paramSize)
param.Value = txtSort.Text
cmd.Parameters.Add(param)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet("Dataset")
da.TableMappings.Add("Table", "DataGrid1")

Try
conn.Open()
da.Fill(ds)
Catch ex As Exception
'Error handling here
Finally
If (conn.State = ConnectionState.Open) Then
conn.Close()
End If

conn.Dispose()

End Try
Return (ds)

End Function

Sub Button1_Click(sender As Object, e As EventArgs)
DataGrid1.DataSource = GetResults(TxtSort)
DataGrid1.DataBind()
End Sub
Any HELP GREATLY APPRECIATED.

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.