943,910 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5523
  • VB.NET RSS
Apr 12th, 2007
0

Error Retrieving Single Data Using ExecuteScalar Method

Expand Post »
Hi, I receive this error "No default member found for type 'Guid'." when I run my application.

db = New SqlConnection(GetConnectionString())
db.Open()

Dim strSQL As String
strSQL = "SELECT GUID FROM MyLog WHERE MyID = '" & strID & "'"

strGUIDTracker = GetSingleData(strSQL)

..................


Function GetSingleData(ByVal sqlText As String) As String
        Dim sd As String
        Dim oConn As SqlConnection
        oConn = New SqlConnection(GetConnectionString())
        Dim strSQLCmd As SqlCommand = New SqlCommand(sqlText, oConn)
        strSQLCmd.Connection.Open()
        sd = strSQLCmd.ExecuteScalar(System.Data.CommandBehavior.CloseConnection)
        Return sd
    End Function

The highlighted line is the statement where the error occured at. I've tested my SQL statements, it really contains a single record.

Can someone please kindly explain to me why am I getting this error here? Thanks alot.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007
Oct 12th, 2008
0

Re: Error Retrieving Single Data Using ExecuteScalar Method

follow the url, it explain how to ExecuteScalar

http://vb.net-informations.com/ado.n...sqlcommand.htm
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bruce2424 is offline Offline
23 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: [HELP]RunPE
Next Thread in VB.NET Forum Timeline: [ask] data types





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC