andycharger Posted July 1, 2003 Posted July 1, 2003 Hi. Im just taking my first steps with .net and im building a web based application. I need to hooc up to my sql server 2000 db from my application. I can see the database in the left hand window and the connection all works. However, I see that you use namespaces to import the classes. Can someone tell me why the namespace is not "intellisensing" when I start typing "System.Data.SqlClient"? I will include my longon page code to ask why I should put this. If someone could provide a simple example as to how I get to my data, I would be forever grateful. Andy Public Class logon Inherits System.Web.UI.Page Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents Label1 As System.Web.UI.WebControls.Label #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim da As sqlDataAdapter = New sqlDataAdapter() Dim strUsername As String Dim strPW As String strUsername = TextBox1.Text strPW = TextBox2.Text Dim strOleDb As String Dim cnOleDb As New OleDBConnection() End Sub End Class Quote
Moderators Robby Posted July 1, 2003 Moderators Posted July 1, 2003 You need to Reference the SqlClient as well as ...(at the top of the code page) Imports System.Data Imports System.Data.SqlClient Quote Visit...Bassic Software
andycharger Posted July 1, 2003 Author Posted July 1, 2003 Where abouts? Can you tell me where? I tried adding the imports bit into the top bit where it says Inherits but it does not pick up the intellisense. I added it into the References for the Project and it worked to a point. It does not like ExecuteReader. Quote
*Experts* mutant Posted July 1, 2003 *Experts* Posted July 1, 2003 At the top of your code/file, not the top of your class :) Quote
*Experts* Nerseus Posted July 2, 2003 *Experts* Posted July 2, 2003 What are your references (in the project)? You should have System.Data at a minimum for this to work. Then having the right Imports statements should do the trick. Check the object browser (ctrl-alt-J) to see what libraries you have available. It pulls from whatever you've got referenced in the solution explorer. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.