 |
| VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB Databases Basics 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
|
|
|
|

January 19th, 2007, 02:31 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
ambiguous references
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:
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 SqlDataReader
I'm getting the following error message(s) (multiple times each) - in the DataSet Adapter!!! - in code that I didn't write, which I really don't understand:
'SqlConnection' is ambiguous in the namespace 'System.Data.SqlClient'
'SqlCommand' is ambiguous in the namespace 'System.Data.SqlClient'
'SqlDataAdapter' is ambiguous in the namespace 'System.Data.SqlClient'
What did I not do in my import statements?
Do I not need the reference for System.Data.SQLClient since I have System.Data?
What am I not understanding?
Thanks,
Karen
|
|

January 19th, 2007, 03:15 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Source thread:
http://p2p.wrox.com/topic.asp?TOPIC_ID=55055
================================================== =========
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^^
================================================== =========
|
|

January 19th, 2007, 03:45 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Doug,
thanks.
The SqlDataReader problem has been resolved. But 100+ ambiguous references for the SqlConnection, SqlCommand, and SqlDataAdapter show up now.
I don't understand what to do to resolve them.
Karen
|
|

January 19th, 2007, 03:48 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
How did you resolve the Datareader problem? Is this a windows app, mobile app?
================================================== =========
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^^
================================================== =========
|
|

January 19th, 2007, 04:32 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Doug,
I really don't know.
I deleted the line and re-typed it and this time it worked.
With all the other ambiguous references, I've gone to the extremes of deleting the entire dataset and recreating it. They are still there when I try to build the project.
Thanks,
Karen
|
|

January 19th, 2007, 04:37 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Very strange. Try a few things:
1)If you are fully qualifing the Connections, Commands, etc (System.Data.SqlClient.<object>) remove your Imports statement from that form, see if that corrects the errors on that page.
2)If the above doesn't work, try removing the Reference to the .dll from your project (although, that in itself, should cause an error)
See what happens.
================================================== =========
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^^
================================================== =========
|
|

January 19th, 2007, 04:47 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Doug,
It is a windows application.
eventually, we will do a mobile version, but first I have to get it working this way.
I've got other screens and menus built and would like to test them, but I need to get past the login screen issues first.
Thanks for all your help.
Karen
|
|

January 19th, 2007, 05:08 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Doug,
I've opened the project and removed the dll from the references list (It was showing up as being in my Visual Studio program files. ?)
Now, I'm back to error messages for the SqlReader - it has no constructor.
I know there has to be a logical explanation for this, but I'm not seeing it right now. (And I know the president/owner of the company is going to be in soon to see what I've accomplished. I can't even show the login screen working.)
I really appreciate your help.
Hopefully, soon I'll be able to pay it forward with other newbies.
Karen
|
|

January 19th, 2007, 05:19 PM
|
|
Friend of Wrox
|
|
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can't create an intance of a DataReader. You can only get a new datareader as the return value of the ExecuteReader method of a command object:
Code:
Dim APCReader As SqlDataReader
Dim MyCommand as SqlCommand
' Code here to set up the command - you'll also need a connection object.
APCReader = MyCommand.ExecuteReader
' Code here to iterate through the reader
Woody Z
http://www.learntoprogramnow.com
|
|

January 19th, 2007, 05:40 PM
|
|
Authorized User
|
|
Join Date: Dec 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Woody Z,
thank you. that got rid of them.
I've commented out the last two lines that have been causing me trouble.
I'm not connecting to the SQL Server yet, but I now have faith that it will happen.
Thank you so very much for jumping into the conversation and finding the problem.
Karen
|
|
 |