471,348 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Error when trying to run a stored procedure

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
1 1738
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.

Similar topics

1 post views Thread by Jennifer | last post: by
9 posts views Thread by dtwilliams | last post: by
11 posts views Thread by ColdCanuck | last post: by
3 posts views Thread by Mike P | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.