Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2007, 05:10 PM
Authorized User
 
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
Default SQL Server datareader

I am attempting to write the login code for my application. I've been looking at a number of examples. but so far, I've been unsuccessful.

This is the code I have right now:

Code:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms

Public Class APCLogin
    Private APCConnString As String
    Private APC_WirelessConnectionStringIntegrated As String
    '"Data Source=SERVER\APCD1;Initial Catalog=APC_Wireless;Integrated Security=True;User Instance=True"
    Private APC_WirelessConnectionStringSQLsrvr As String
    '"Data Source=SERVER\APCD1;Initial Catalog=APC_Wireless;User ID=?;Password=?"

...

Private Sub APCLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim blnSecurityType As Boolean
        'Dim cnStr As String 'connection string

        If blnSecurityType Then
            'integrated security version
            APCConnString = APC_WirelessConnectionStringIntegrated
        Else
            'sql server security version
            APCConnString = APC_WirelessConnectionStringSQLsrvr
        End If
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Dim APCReader As New System.Data.SqlClient.SqlDataReader()
I'm getting the following error message, which I don't understand:
'SqlDataReader' is ambiguous in the namespace 'System.Data.SqlClient'

What did I not do in my imports statements?

Thanks,
Karen


 
Old January 18th, 2007, 05:19 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Try this:

Dim APCReader as SqlDataReader



================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old January 19th, 2007, 12:50 PM
Authorized User
 
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
Default

Still happening ...



 
Old January 19th, 2007, 02:07 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

hmm I can't solve this. Its not that you didn't do something but, it seems, you are somehow referencing 2 classes that both contain a definition for the DataReader. (To be honest I have no idea how you are doing this, did you add a reference the System.Data class to your project twice?)

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old January 19th, 2007, 02:41 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

What's even more interesting is that the compiler doesn't give you a warning about newing up a SqlDataReader since it has no public constructors....

Is this all the code? Or is there more that can influence this situation?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old February 6th, 2007, 06:11 AM
Registered User
 
Join Date: Feb 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the Best approach for Processing Sql commands Asynchrnously?

Call back/ Wait handler /Polling...

under Which casee we have to pick

 
Old February 6th, 2007, 06:18 AM
Registered User
 
Join Date: Feb 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is a no public constructor, so you can't create an instance of datareader.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Conflict in SQL Server 2000 and SQL Server 2005 ayan.mukherjee SQL Language 0 June 30th, 2008 03:34 AM
SQL Server Reg. SQL Server does not exist error Arsi SQL Server 2000 1 June 11th, 2008 11:20 AM
migrating from sql server 2000 to sql server 2005 abinashpatra SQL Server 2005 2 December 1st, 2006 03:45 PM
SQL Server sync with net server and browser server ne SQL Server DTS 0 June 13th, 2005 06:29 PM
SQL Server 7.0 talking to SQL Server 2000 msavage SQL Server 2000 1 August 20th, 2003 01:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.