473,372 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 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 1869
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jennifer | last post by:
I've got a job that sends out the results of a stored procedure in an email via xp_sendmail. The job code is as follows: DECLARE @rlist varchar(1000) Declare @Q varchar(100) Select @Q =...
4
by: shyner | last post by:
Hi Everyone, I've been battling this for two days with no luck. I'm using SQL Server 2000. Here's the mystery: I've got a stored procedure that takes a single varchar parameter to determine...
9
by: dtwilliams | last post by:
OK, i'm trying to do some error checking on stored procedures and am following the advise in Erland Sommarskog's 'Implementing Error Handling with Stored Procedures' document. Can anybody help...
0
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the...
11
by: ColdCanuck | last post by:
Greetings! I am VERY new to DB2 but not Orable, Sybase and SQL Server. I am trying to call a stored procedure via VB 6 and ADO/OLEDB. But when I try to execute
4
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE...
3
by: Goog79 | last post by:
Hi everyone, first time here, so I'm sorry if this has been covered already ages ago. :( I am trying to learn T-SQL and Stored Procedures and bought the book on these topics by Djan...
3
by: Mike P | last post by:
I am repeatedly getting the error message 'error converting datatype varchar to bit'. I am passing a varchar variable to a stored procedure (where it is also a varchar) and then trying to write it...
2
by: sqlgirl | last post by:
Hi, We have 2 servers. Server1 is a 2000 box, with SP3 (yes I know it is not up to date). Server2 is a 2005 box, SP2. I set up Server1 (2000) to have a linked server to Server2 (2005). The...
5
by: Rahul B | last post by:
Hi, I have very little knowledge about creating Procedures/functions in DB2. When i tried to create the test function like CREATE FUNCTION GET_TEST (P_TEST_ID INTEGER, P_SEL_OR_SORT...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.