Here's my code:
Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s)
Dim db As New SqlConnection
Dim strSQL As String = "SELECT * FROM users WHERE strUsername = '" &
txtUsername.Tex t & "'"
Dim ds1 As DataSet = New DataSet()
db.ConnectionSt ring = "Data Source=.\SQLExp ress;Integrated
Security=True;U ser
Instance=True;d atabase=permit5 0;AttachDBFilen ame=|DataDirect ory|aspnetdb.md f;"
db.Open()
Dim mySqlAdapter As SqlDataAdapter = New SqlDataAdapter( strSQL, db)
mySqlAdapter.Fi ll(ds1, "users")
If ds1.Tables("str Username").Rows .Count = 0 Then
lblError.Text = "Invalid Username"
Else
If ds1.Tables("USe rs").Columns("s trPassword").Ca ption <> Not
txtPassword.Tex t Then
lblError.Text = "Invalid Password"
Else
Session("tblUse rsID") =
ds1.Tables("Use rs").Columns("t blUsersID").Cap tion
Session("strFir stname") =
ds1.Tables("Use rs").Columns("s trFirstname").C aption
Session("strUse rname") =
ds1.Tables("Use rs").Columns("s trUsername").Ca ption
Response.Redire ct("welcome.asp x")
End If
End If
End Sub
My Error is on the part that goes: mySqlAdapter.Fi ll(ds1, "users")
My error message is:System.data. SqlClientExcept ion: Invalid pbject name
'users'.
Users does exist in my database. I am using SQL Server 2005 Express.
Any Ideas? Any Questions? 6 1411
Hi,
Check if your Adapter object is really valid and then verify also your ds1
object
Try to remove second parameter of the Fill method to verify if it able to
fill data in default dataset table name
When you create a dataset obect it has a default table named Table1
When you use the fill method as you do, the second string could be anything
and will be used as the dataset table name object
"Camper Joe" wrote: Here's my code:
Protected Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Dim db As New SqlConnection Dim strSQL As String = "SELECT * FROM users WHERE strUsername = '" & txtUsername.Tex t & "'" Dim ds1 As DataSet = New DataSet()
db.ConnectionSt ring = "Data Source=.\SQLExp ress;Integrated Security=True;U ser Instance=True;d atabase=permit5 0;AttachDBFilen ame=|DataDirect ory|aspnetdb.md f;" db.Open()
Dim mySqlAdapter As SqlDataAdapter = New SqlDataAdapter( strSQL, db) mySqlAdapter.Fi ll(ds1, "users")
If ds1.Tables("str Username").Rows .Count = 0 Then lblError.Text = "Invalid Username" Else If ds1.Tables("USe rs").Columns("s trPassword").Ca ption <> Not txtPassword.Tex t Then lblError.Text = "Invalid Password" Else Session("tblUse rsID") = ds1.Tables("Use rs").Columns("t blUsersID").Cap tion Session("strFir stname") = ds1.Tables("Use rs").Columns("s trFirstname").C aption Session("strUse rname") = ds1.Tables("Use rs").Columns("s trUsername").Ca ption Response.Redire ct("welcome.asp x") End If End If
End Sub My Error is on the part that goes: mySqlAdapter.Fi ll(ds1, "users")
My error message is:System.data. SqlClientExcept ion: Invalid pbject name 'users'.
Users does exist in my database. I am using SQL Server 2005 Express.
Any Ideas? Any Questions?
Hi.
Thanks for the advice.
I've tried it. Whether I leave the second part of the .fill blank, or put in
"table1", it still
gives me the error System.Data.Sql Client.SqlExcep tion: Invalid object name
'users'.
CJ
"serge calderara" wrote: Hi,
Check if your Adapter object is really valid and then verify also your ds1 object Try to remove second parameter of the Fill method to verify if it able to fill data in default dataset table name
When you create a dataset obect it has a default table named Table1 When you use the fill method as you do, the second string could be anything and will be used as the dataset table name object
"Camper Joe" wrote:
Here's my code:
Protected Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Dim db As New SqlConnection Dim strSQL As String = "SELECT * FROM users WHERE strUsername = '" & txtUsername.Tex t & "'" Dim ds1 As DataSet = New DataSet()
db.ConnectionSt ring = "Data Source=.\SQLExp ress;Integrated Security=True;U ser Instance=True;d atabase=permit5 0;AttachDBFilen ame=|DataDirect ory|aspnetdb.md f;" db.Open()
Dim mySqlAdapter As SqlDataAdapter = New SqlDataAdapter( strSQL, db) mySqlAdapter.Fi ll(ds1, "users")
If ds1.Tables("str Username").Rows .Count = 0 Then lblError.Text = "Invalid Username" Else If ds1.Tables("USe rs").Columns("s trPassword").Ca ption <> Not txtPassword.Tex t Then lblError.Text = "Invalid Password" Else Session("tblUse rsID") = ds1.Tables("Use rs").Columns("t blUsersID").Cap tion Session("strFir stname") = ds1.Tables("Use rs").Columns("s trFirstname").C aption Session("strUse rname") = ds1.Tables("Use rs").Columns("s trUsername").Ca ption Response.Redire ct("welcome.asp x") End If End If
End Sub My Error is on the part that goes: mySqlAdapter.Fi ll(ds1, "users")
My error message is:System.data. SqlClientExcept ion: Invalid pbject name 'users'.
Users does exist in my database. I am using SQL Server 2005 Express.
Any Ideas? Any Questions?
hi,
u may assign a name to dataset at creating time..
dim ds as dataset=new dataset("user1" )
and please use try catch exception with finally....
u may better just declare variable first, then use try catch exception
and open connection
allocate memory for adapter then dataset and do further ur business
programming...
this all may help u to solve prob....
kashif ahmed
if mySqlAdapter.Fi ll(ds1) generate the error then try to verify your SQl
query within SQL querry to check if it works.
If it is, the from your code juste for test run the query "SELECT * FROM
user" just to check
If it works, verify your SQL string when it is build
regards
serge
"Camper Joe" wrote: Hi.
Thanks for the advice. I've tried it. Whether I leave the second part of the .fill blank, or put in "table1", it still gives me the error System.Data.Sql Client.SqlExcep tion: Invalid object name 'users'.
CJ "serge calderara" wrote:
Hi,
Check if your Adapter object is really valid and then verify also your ds1 object Try to remove second parameter of the Fill method to verify if it able to fill data in default dataset table name
When you create a dataset obect it has a default table named Table1 When you use the fill method as you do, the second string could be anything and will be used as the dataset table name object
"Camper Joe" wrote:
Here's my code:
Protected Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Dim db As New SqlConnection Dim strSQL As String = "SELECT * FROM users WHERE strUsername = '" & txtUsername.Tex t & "'" Dim ds1 As DataSet = New DataSet()
db.ConnectionSt ring = "Data Source=.\SQLExp ress;Integrated Security=True;U ser Instance=True;d atabase=permit5 0;AttachDBFilen ame=|DataDirect ory|aspnetdb.md f;" db.Open()
Dim mySqlAdapter As SqlDataAdapter = New SqlDataAdapter( strSQL, db) mySqlAdapter.Fi ll(ds1, "users")
If ds1.Tables("str Username").Rows .Count = 0 Then lblError.Text = "Invalid Username" Else If ds1.Tables("USe rs").Columns("s trPassword").Ca ption <> Not txtPassword.Tex t Then lblError.Text = "Invalid Password" Else Session("tblUse rsID") = ds1.Tables("Use rs").Columns("t blUsersID").Cap tion Session("strFir stname") = ds1.Tables("Use rs").Columns("s trFirstname").C aption Session("strUse rname") = ds1.Tables("Use rs").Columns("s trUsername").Ca ption Response.Redire ct("welcome.asp x") End If End If
End Sub My Error is on the part that goes: mySqlAdapter.Fi ll(ds1, "users")
My error message is:System.data. SqlClientExcept ion: Invalid pbject name 'users'.
Users does exist in my database. I am using SQL Server 2005 Express.
Any Ideas? Any Questions?
Thanks for the support.
After reading up on datasets, I saw that if your SELECT query doesn't return
any rows, the table object doesn't get created.
CJ.
"ka************ ****@gmail.com" wrote: hi,
u may assign a name to dataset at creating time..
dim ds as dataset=new dataset("user1" )
and please use try catch exception with finally....
u may better just declare variable first, then use try catch exception and open connection
allocate memory for adapter then dataset and do further ur business programming...
this all may help u to solve prob....
kashif ahmed
Thanks for the support.
After reading up on datasets, I saw that if your SELECT query doesn't return
any rows, the table object doesn't get created.
CJ.
"serge calderara" wrote: if mySqlAdapter.Fi ll(ds1) generate the error then try to verify your SQl query within SQL querry to check if it works.
If it is, the from your code juste for test run the query "SELECT * FROM user" just to check
If it works, verify your SQL string when it is build
regards serge "Camper Joe" wrote:
Hi.
Thanks for the advice. I've tried it. Whether I leave the second part of the .fill blank, or put in "table1", it still gives me the error System.Data.Sql Client.SqlExcep tion: Invalid object name 'users'.
CJ "serge calderara" wrote:
Hi,
Check if your Adapter object is really valid and then verify also your ds1 object Try to remove second parameter of the Fill method to verify if it able to fill data in default dataset table name
When you create a dataset obect it has a default table named Table1 When you use the fill method as you do, the second string could be anything and will be used as the dataset table name object
"Camper Joe" wrote:
> Here's my code: > > Protected Sub Button1_Click(B yVal sender As Object, ByVal e As > System.EventArg s) > Dim db As New SqlConnection > Dim strSQL As String = "SELECT * FROM users WHERE strUsername = '" & > txtUsername.Tex t & "'" > Dim ds1 As DataSet = New DataSet() > > db.ConnectionSt ring = "Data Source=.\SQLExp ress;Integrated > Security=True;U ser > Instance=True;d atabase=permit5 0;AttachDBFilen ame=|DataDirect ory|aspnetdb.md f;" > db.Open() > > Dim mySqlAdapter As SqlDataAdapter = New SqlDataAdapter( strSQL, db) > mySqlAdapter.Fi ll(ds1, "users") > > If ds1.Tables("str Username").Rows .Count = 0 Then > lblError.Text = "Invalid Username" > Else > If ds1.Tables("USe rs").Columns("s trPassword").Ca ption <> Not > txtPassword.Tex t Then > lblError.Text = "Invalid Password" > Else > Session("tblUse rsID") = > ds1.Tables("Use rs").Columns("t blUsersID").Cap tion > Session("strFir stname") = > ds1.Tables("Use rs").Columns("s trFirstname").C aption > Session("strUse rname") = > ds1.Tables("Use rs").Columns("s trUsername").Ca ption > Response.Redire ct("welcome.asp x") > End If > End If > > > End Sub > > > > My Error is on the part that goes: mySqlAdapter.Fi ll(ds1, "users") > > My error message is:System.data. SqlClientExcept ion: Invalid pbject name > 'users'. > > Users does exist in my database. I am using SQL Server 2005 Express. > > Any Ideas? Any Questions? > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Scott M. Lyon |
last post by:
I've just discovered a bug in some code I wrote a little while ago, and I
need you guys' help to fix it.
My program imports data from a standard Excel Spreadsheet (just with
specific column headers). I used ODBC in my VB.NET program to read that
spreadsheet into a dataset, to make it easy to manipulate. The code I use to
read it is as the bottom of this posting.
|
by: DC |
last post by:
The Code
<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
|
by: Angel \Java\ Lopez |
last post by:
Hi people!
I'm running a Visual Studio 2005, Professional, on Windows XP Professional.
I've found a little big problem, reading a DataSet. If I try:
ds.ReadXml("c:\data.xml")
it raises the exception ONLY in Web Sites:
|
by: shibeta |
last post by:
Hello,
I have problem with DataGridView and BindingSource. I have created
DataSet and added TableData to it with manualy created columns
(without DataAdapter - I'm not using MSSQL). On the Form I put
DataGridView and BindingSource, and connected them (BindingSource of
course is also connected with DataSet). Next on the separated thread
I'm reading data from DB and load them do DataSet (more preciselly,
readed data I've saved as XML and...
|
by: David |
last post by:
Hi,
(Sorry for duplicate post, finger trouble before I finished...)
using C# 1.1
I am writing a winform app that collects a dataset from a webservice.
At the same time I collect the data, I write the dataset out to the local
disk using DataSet.WriteXml, so that if the webservice is not available,
| |
by: Martin Madreza |
last post by:
Hi,
I have a problem with reading an XmlSchema with Frameowk 2.0 and an
own DataType. I found no example
(searching two days).
What I do is:
DataSet dataSet = new DataSet();
dataSet.ReadXml("{path}/MySchemaAndData.xml");
|
by: Bill Nguyen |
last post by:
I'm reading a CSV file with the date colum formatted as "YYMMDD" -"070310"
when viewed in notepad or similar trext editor.
However, in my app, using ODBCReader, the column value becomes "70310"
(integer value). This invalidates my attempt to convert the field into a
date field. I notice that this happened to other columns as well.
Is there a way to keep the original format (or to convert into date field
for this column?
Thanks
|
by: David |
last post by:
Hi,
using C# asp.net 1.1
I am having a problem. If I use the code below, but have null passed as the
PostingGuid, then by the time I get to fill the dataset, I have "an object
is not set to an instance of an object". This then totally knocks out any
connection to my database for the rest of my application until I terminate
the aspnet process.
|
by: slinky |
last post by:
I'm working on a problem with a form with 6 textboxes and a submit
button for adding data to an Access database.I changed a few things
and got it down to 1 error!. I have a Sub
Page_Load and a Sub btnAdd:
(It still doesn't like the 'SourceVersion' in the Sub Page_Load).
Also
I viewed the .aspx in the browser and got an error which I posted
complete at the bottom of this post). Thanks for any clues... I'm
almost there!!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |