Friday, March 30, 2012
NEWBIE question for ya!
I'll be using asp and mssql 2k.
Like friday between 8:00pm to 10pm to display
then on Saturday between 2:00pm and 4:00pm to display and for the rest of
the time not display. any suggetions.
I've been looking at getday()
any suggetions?
Thank you for your time in advanced.
Message posted via http://www.sqlmonster.com
Sven,
Check this article:
http://www.karaszi.com/sqlserver/inf...asp#Searching.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Sven Garber via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:a2eae88fcfcc4a3494bcb278914a66d9@.SQLMonster.c om...
> I ve been ask to diplay some infomation based a certain date and time.
> I'll be using asp and mssql 2k.
> Like friday between 8:00pm to 10pm to display
> then on Saturday between 2:00pm and 4:00pm to display and for the rest of
> the time not display. any suggetions.
> I've been looking at getday()
> any suggetions?
> Thank you for your time in advanced.
> --
> Message posted via http://www.sqlmonster.com
|||Dejan,
Thank you for the link referal...
Sharing is caring...
Thank you
Message posted via http://www.sqlmonster.com
NEWBIE question for ya!
I'll be using asp and mssql 2k.
Like friday between 8:00pm to 10pm to display
then on Saturday between 2:00pm and 4:00pm to display and for the rest of
the time not display. any suggetions.
I've been looking at getday()
any suggetions?
Thank you for your time in advanced.
Message posted via http://www.droptable.comSven,
Check this article:
http://www.karaszi.com/sqlserver/in...asp#Searching.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Sven Garber via droptable.com" <forum@.droptable.com> wrote in message
news:a2eae88fcfcc4a3494bcb278914a66d9@.SQ
droptable.com...
> I ve been ask to diplay some infomation based a certain date and time.
> I'll be using asp and mssql 2k.
> Like friday between 8:00pm to 10pm to display
> then on Saturday between 2:00pm and 4:00pm to display and for the rest of
> the time not display. any suggetions.
> I've been looking at getday()
> any suggetions?
> Thank you for your time in advanced.
> --
> Message posted via http://www.droptable.com|||Dejan,
Thank you for the link referal...
Sharing is caring...
Thank you
Message posted via http://www.droptable.com
NEWBIE question for ya!
I'll be using asp and mssql 2k.
Like friday between 8:00pm to 10pm to display
then on Saturday between 2:00pm and 4:00pm to display and for the rest of
the time not display. any suggetions.
I've been looking at getday()
any suggetions?
Thank you for your time in advanced.
--
Message posted via http://www.sqlmonster.comSven,
Check this article:
http://www.karaszi.com/sqlserver/info_datetime.asp#Searching.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Sven Garber via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:a2eae88fcfcc4a3494bcb278914a66d9@.SQLMonster.com...
> I ve been ask to diplay some infomation based a certain date and time.
> I'll be using asp and mssql 2k.
> Like friday between 8:00pm to 10pm to display
> then on Saturday between 2:00pm and 4:00pm to display and for the rest of
> the time not display. any suggetions.
> I've been looking at getday()
> any suggetions?
> Thank you for your time in advanced.
> --
> Message posted via http://www.sqlmonster.com|||Dejan,
Thank you for the link referal...
Sharing is caring...
Thank you
--
Message posted via http://www.sqlmonster.com
Monday, March 26, 2012
Newbie question
Good morning,
I am quite new to using ASP and SQL together, I have tried all the tutorials I can find and most of it makes enough sense that I am able to bumble my way through what I am trying to do, but I am not able to find any reliable information on how to do the following:
I want to call a SQL stored proc, by pressing a "submit" button. It is for a simple login... the user types in their username and password, then I get the data from the fields with Request.Form.Get("blah")s. The stored proc returns a true or false to indicate success or failure.
The SQL server that I am trying to use is called 'Trim2005' and the database is called 'Internet Database'
Since I'm learning, if anyone has a better way which is not too much harder than what I am trying to do (or easier, if I'm lucky )then I would be very interested to hear of it.
Set cmdupdate=Server.CreateObject("Adodb.Command")
cmdupdate.ActiveConnection=conn
cmdUpdate.CommandText="Trim2005"
cmdUpdate.CommandType=adCmdStoredProc
Then Execute the above
'Conn' is the connection String
Regards,
Gautham
|||Data Source=TRIM2005;Initial Catalog="Internet Database";Integrated Security=True
This is the connection string, right? I got it by creating a dropdown list and then copying and pasting the connection string during the 'select data source' wizard. If so, would I surround the whole thing in brackets or quotations, or neither? In addition, every time I try to type "set cmdupdate" it removes the word set and then complains that the variable has not been defined. Would I resolve this by adding 'Dim cmdupdate'?
How would I pass in the login and password? I am storing them as session vars Session("Username") and Session("Password")
Thanks,
|||Normally, you'd do it like this:
strConn="Data Source=TRIM2005;Initial Catalog=Internet Database;Integrated Security=True"
surrounding it all with double quotes.
(of course, the strconn part is not necessary - it just shows how to refer to the connection string in general)
|||Are you using ASP or ASP.NET? Sounds like ASP.NET. If that's the case, I wouldn't use ADO. Use the native SqlConnection and SqlCommand instead.|||I am using ASP.NET (blah.aspx) I believe.
So then how would I use the SqlConnection + SqlCommand instead of ADO?
Sorry to ask so many questions, but the tutorials I have been able to find are only slightly helpful as I do not actually know VBscripting.. sorta learning that as I go along. I know a smattering of JS, but all of my programming experience is in C/C++ and Java.
I realized after posting my questions that I should have chose a more relevant subject too, but too late for that :/
|||dim conn as new SqlConnection("{Your connect string here"})
conn.open
dim cmd as new SqlCommand("{Your stored procedure name here}",conn)
cmd.CommandType=StoredProcedure ' Sorry, this isn't 100% correct, the property and/or value may actually be different
cmd.parameters.add("@.{Your parameter name here}",SqlDbType.{Your data type here - probably VarChar or Int32}).Value={Your parameter value}
.. repeat for each parameter .. (Loginname,password?)
cmd.parameters.add("@.RETURN_VALUE",SqlDbType.Int32).Direction=returnvalue
cmd.executenonquery
dim result as integer=cmd.parameters("@.RETURN_VALUE").Value
conn.close
That assumes that when you said the stored procedure returns a true/false, you meant as a return value rather than an output parameter. An output parameter would be similiar, except you'd use these lines instead of the return_value stuff:
cmd.parameters.add("@.{output parameter name}",SqlDbType.boolean).Direction=output
dim result as integer=cmd.parameters("@.{output parameter name}").Value
|||My code is at the bottom, I just wanted to post it so that someone could make sure I'm not typing something wrong. I know that my sub doesn't do anything yet, I just wanted to test out whether or not it would work and reply back asap. I get the following errors:
It does not recognize SqlDbType or "as new SqlConnection" nor does it recognize "ReturnValue" where I add my return parameter. I suspect that the reason for these is that I need to import a header?
Sorry for how long it takes me to reply, a mod needs to clear my post before I can reply to anything. I would like to thank everyone for their help so far, it has all been a learning experiance and once I know how to do this the first time I'll not need to ask again. I've a long way to go, but I look forward to learning how to do everything.
ProtectedSub loginButton_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)
Dim connAsNew SqlConnection("Data Source=TRIM2005;Initial Catalog=Internet Database;Integrated Security=True")
conn.open()
Dim cmdAsNew SqlCommand("Login")
cmd.parameters.add("@.Username",SqlDbType.VarChar).Value = usernameTextbox.Text
cmd.parameters.add("@.Password",SqlDbType.VarChar).Value = passwordTextbox.Text
cmd.parameters.add("@.RETURN_VALUE",SqlDbType.VarChar).Direction =ReturnValue
cmd.executenonquery()
Dim resultAsInteger = cmd.parameters("@.RETURN_VALUE").Value
conn.close()
EndSub
|||imports system.data
imports system.data.sqlclient
at the top of the page.
The second parameter to your new SqlCommand, should be conn:
Dim cmd as New SqlCommand("Login",conn)
and you aren't setting the commandtype to storedprocedure yet, sorry I don't know the exact property off hand, and I suspect you are putting this off until you have the correct imports so that you can use intellisense to find the right one.
|||in order to import I just type those at the top of the page? I tried adding those two imports to the very top of the page as they are written in your post, and I have not gotten any intellisense on anything.
It recommends that I change the SqlCommand and SqlConnection to Data.SqlClient.SqlCommand and Data.SqlClient.SqlConnection. I figure that since those look pretty much identical to the imports you suggest, that might work.
I am, however, still having trouble with the datatype SqlDbType... is this supposed to be something user-defined, or is there a data type in one of these imports which seems to not be importing? I will google importing when I get a chance, but I'm swamped at the moment.
Thanks,
|||<%@.importnamespace="system.data"%>
<%@.importnamespace="system.data.sqlclient"%>
...............
ProtectedSub loginButton_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)
Dim connAsNew Data.SqlClient.SqlConnection("Data Source=TRIM2005;Initial Catalog=Internet Database;Integrated Security=True")
conn.Open()
Dim cmdAsNew Data.SqlClient.SqlCommand("Login", conn)
cmd.Parameters.Add("@.Username", SqlDbType.VarChar).Value = usernameTextbox.Text
cmd.Parameters.Add("@.Password", SqlDbType.VarChar).Value = passwordTextbox.Text
cmd.Parameters.Add("@.RETURN_VALUE", SqlDbType.VarChar).Direction = ParameterDirection.ReturnValue
cmd.ExecuteNonQuery()
Dim resultAsString = cmd.Parameters("@.RETURN_VALUE").Value
conn.Close()
Response.Write(result)
EndSub
Okay :) I have all but one bug worked out (or so I think) and it was mentioned above I believe. I get an error during runtime about cmd.ExecuteNonQuery(). It doesn't really say what it is, it just dumps out the call stack. "Incorrect syntax near 'Login'."is the exception detail.
What I believe the problem might be is that it is not sending a query as it is saying to ExecuteNonQuery and then is expecting a return value.. but I don't really know so I would be quite happy if someone could explain what I am missing.
I have decided instead to return the username of the successful login(a failure results in an empty string which I will later account for as a failed attempt)
|||
Obsidian Shadow wrote:
I get an error during runtime about cmd.ExecuteNonQuery(). It doesn't really say what it is, it just dumps out the call stack. "Incorrect syntax near 'Login'."is the exception detail.
I am pretty sure the problem is that you have not set your SqlCommand'sCommandType, which will therefore default to CommandType.Text. Add a line to set the CommandType to CommandType.StoredProcedure:
Dim cmdAsNew Data.SqlClient.SqlCommand("Login", conn)
cmd.CommandType = CommandType.StoredProcedure
The incorrect syntax is caused because you failed to set the commandtype property.
However, you can't return a varchar as a return_value. Return_value must be an int. Your SP should look something like this:
CREATE PROCEDURE Login
@.Username varchar(40)
@.Password varchar(40)
AS
RETURN (SELECT COUNT(*) FROM LoginTable WHEREUsername=@.Username andPassword=@.Password)
GO
And yes, doing the import basically just allows you to shorten what you type, for example:
Dim conn as new System.data.sqlclient.sqlconnection("...")
becomes
Dim conn as new SqlConnection("...")
if you have system.data.sqlclient imported.
|||Thank you everyone, I am now using the stored procedure.
Syntax error converting the varchar value 'ekisner' to a column of data type int.
I have checked my stored procedure, and I have checked my sub and I cannot find where it would be trying to convert to an int, so I am left with posting both here to see what you guys know that I don't. When I execute the query outside of the webpage, I get the same error, which leads me to believe that it is my procedure that is not working correctly.
My sub:
ProtectedSub loginButton_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)
Dim connAsNew Data.SqlClient.SqlConnection("Data Source=TRIM2005;Initial Catalog=Internet Database;Integrated Security=True")
conn.Open()
Dim cmdAsNew Data.SqlClient.SqlCommand("Login", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@.Username", SqlDbType.VarChar).Value = usernameTextbox.Text
cmd.Parameters.Add("@.Password", SqlDbType.VarChar).Value = passwordTextbox.Text
cmd.Parameters.Add("@.RETURN_VALUE", SqlDbType.VarChar).Direction = ParameterDirection.ReturnValue
cmd.ExecuteNonQuery()
Dim result = cmd.Parameters("@.RETURN_VALUE").Value
conn.Close()
Response.Write(result)
EndSub
My SP:
CREATE PROCEDURE dbo.Login
@.username varchar(50),
@.password varchar(50)
AS
RETURN(
SELECT Username
FROM Users
WHEREUsername=@.username ANDPassword=@.password
)
GO
Read my last post.
Friday, March 23, 2012
Newbie question
My company has a legacy web application (VBScript/ASP) that includes a
series of forms used to create various reports on SQL Server (or Oracle)
data. Creation of these reports is extremely tedious due to fairly
complicated calculations etc. My question for the group is: Is MS
Reporting Services a valid alternative to the way i'm doing things now? I
need to be able to create new interactive custom reports fairly easily and
link to them via the old web application.
Thanks In Advance,
TeddRS integrates pretty easily with custom web apps particularly for intranet
apps. You can use either URL integration or web services integration. URL
integration is the easiest and fullest featured (you have roll you own a lot
more when using web services). SQL Server reporting is very easy. The main
thing with Oracle is getting all the client apps installed and properly
configured (but that is not too untypical of anything concerning Oracle). I
go against Sybase and SQL Server. Others once up and running have been
successfull with Oracle. With RS 2005 (released in November) my expectation
is Oracle will be easier to go against. It also has a good many improvements
(my two favorites are dynamic sorting and multi-select parameters). I would
suggest getting the 90 day trial and give it a try.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Tedd Simms" <tedd.simms.SPAMTRAP@.cognostech.com> wrote in message
news:yf-dnbYtb-kzmF7fRVn-gQ@.novus-tele.net...
> Hi All,
> My company has a legacy web application (VBScript/ASP) that includes a
> series of forms used to create various reports on SQL Server (or Oracle)
> data. Creation of these reports is extremely tedious due to fairly
> complicated calculations etc. My question for the group is: Is MS
> Reporting Services a valid alternative to the way i'm doing things now? I
> need to be able to create new interactive custom reports fairly easily and
> link to them via the old web application.
> Thanks In Advance,
> Tedd
>|||"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:etoRWSPfFHA.1948@.TK2MSFTNGP12.phx.gbl...
> RS integrates pretty easily with custom web apps particularly for intranet
> apps. You can use either URL integration or web services integration. URL
> integration is the easiest and fullest featured (you have roll you own a
> lot more when using web services). SQL Server reporting is very easy. The
> main thing with Oracle is getting all the client apps installed and
> properly configured (but that is not too untypical of anything concerning
> Oracle). I go against Sybase and SQL Server. Others once up and running
> have been successfull with Oracle. With RS 2005 (released in November) my
> expectation is Oracle will be easier to go against. It also has a good
> many improvements (my two favorites are dynamic sorting and multi-select
> parameters). I would suggest getting the 90 day trial and give it a try.
Thanks for the response Bruce.
Actually, i'm not too worried about using it with Oracle. I'm trying to
convince my boss to discontinue development and support for it.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Tedd Simms" <tedd.simms.SPAMTRAP@.cognostech.com> wrote in message
> news:yf-dnbYtb-kzmF7fRVn-gQ@.novus-tele.net...
>> Hi All,
>> My company has a legacy web application (VBScript/ASP) that includes a
>> series of forms used to create various reports on SQL Server (or Oracle)
>> data. Creation of these reports is extremely tedious due to fairly
>> complicated calculations etc. My question for the group is: Is MS
>> Reporting Services a valid alternative to the way i'm doing things now?
>> I need to be able to create new interactive custom reports fairly easily
>> and link to them via the old web application.
>> Thanks In Advance,
>> Tedd
>
Wednesday, March 21, 2012
newbie q: "contacting server to create web project" runs forever
Dell 9300 1.6 GHZ
XP pro 2004 w/service pack2
Hi,
It seems the problem is that the VS does not find your local server.
(Reason my be, you have changed your machin IP somtime after Installing the VS)
Check the server name on new project dialog box and if needed change
it to localhost or the IP address of your system.
newbie q: "contacting server to create web project" runs forever
Dell 9300 1.6 GHZ
XP pro 2004 w/service pack2
Hi,
It seems the problem is that the VS does not find your local server.
(Reason my be, you have changed your machin IP somtime after Installing the VS)
Check the server name on new project dialog box and if needed change
it to localhost or the IP address of your system.
Newbie Q setting up MSDE
and it says 'Not Connected' when I mouseover the icon in the system tray. I
opened the SQL Server service manager, and there are two empty fields-
Server and Services. Please, what do I put in these fields? Also, what
connection string would I use with MSDE. Thanks a lot
Justin Dutoit
hi Justin,
"Justin Dutoit" <anon@.anon.com> ha scritto nel messaggio
news:%23Gr48BqqEHA.3988@.tk2msftngp13.phx.gbl
> Hello. I've installed MSDE (Win2k machine, running asp.net on
> localhost), and it says 'Not Connected' when I mouseover the icon in
> the system tray. I opened the SQL Server service manager, and there
> are two empty fields- Server and Services. Please, what do I put in
> these fields? Also, what connection string would I use with MSDE.
> Thanks a lot
> Justin Dutoit
please verify, using the services applet (control panel->performance and
maintenance->administrative tools->services [on XP] , control
panel->administrative tools->services [on Win2k]) that your MSDE instance is
currently up and running...
you can then try typing in the service name of your MSDE instance to manage
it...
MSDE installs by default disabling network protocols and this can be an
issue for some ODBC related functions and, sometime, the SQL Server
instances are not enlisted by the Service Manager, as reported in
http://support.microsoft.com/default...b;EN-US;814132
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
Monday, March 19, 2012
Newbie needs to be told where to go! (Cross-Post)
I've been developing web applications with asp/sql and access for some
time now on existing servers. I am now in a situation that requires me to
install SQL Server (SBS 2K sp3) as the backend for an intranet served from
IIS. I've installed the SQL services and have created the database and I
have some of the web based application written, no problem, but I've yet to
be able to access the database that I created on the newly installed SQL
server from the web based applications. Even after setting up the virtual
directory with the IIS SQL snap-in, I only get a DNS Server not found error
when I try to browse the site. If I remove the IIS/SQL virtual directory, I
can browse pages that don't error out due to data references.
Where can I find a walk through for setting up SQL Server and IIS to
function together in this very basic manner?
Thanks in advance.
--
Jerry M. Gartner
www.gartnerwebdev.comHi,
Have a look at these...
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;176378
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;176380
http://support.microsoft.com/default.aspx?scid=kb;zh-
cn;chs264921
http://support.microsoft.com/default.aspx?scid=kb;PL;264921
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;245243
>--Original Message--
>Greetings:
> I've been developing web applications with asp/sql
and access for some
>time now on existing servers. I am now in a situation
that requires me to
>install SQL Server (SBS 2K sp3) as the backend for an
intranet served from
>IIS. I've installed the SQL services and have created
the database and I
>have some of the web based application written, no
problem, but I've yet to
>be able to access the database that I created on the
newly installed SQL
>server from the web based applications. Even after
setting up the virtual
>directory with the IIS SQL snap-in, I only get a DNS
Server not found error
>when I try to browse the site. If I remove the IIS/SQL
virtual directory, I
>can browse pages that don't error out due to data
references.
> Where can I find a walk through for setting up SQL
Server and IIS to
>function together in this very basic manner?
>Thanks in advance.
>
>--
>Jerry M. Gartner
>www.gartnerwebdev.com
>
>.
>|||Peter:
Preliminarily, this appears to be what I'm looking for. I didn't think
to use ODBC and a DSN. What are the major differences between ODBC and
"direct" connection? There will be under 30 clients using the DB - this is
an on demand intranet application and will be hit lightly and sporadically
throughout the day. The SQL server is also the PDC and fileserver/DFS root
and gateway. (2K SP4)
--
Jerry M. Gartner
www.gartnerwebdev.com
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:03de01c3a83a$14ef9140$a001280a@.phx.gbl...
> Hi,
> Have a look at these...
> http://support.microsoft.com/default.aspx?scid=kb;EN-
> US;176378
> http://support.microsoft.com/default.aspx?scid=kb;EN-
> US;176380
> http://support.microsoft.com/default.aspx?scid=kb;zh-
> cn;chs264921
> http://support.microsoft.com/default.aspx?scid=kb;PL;264921
> http://support.microsoft.com/default.aspx?scid=kb;EN-
> US;245243
Newbie needs help with SQL 2000
need to get something more stable -
I have been told that the best option would be MS SQL2000 - however, I
really don't know where to start.
Can anybody point me in the right direction of a "simple" step by step
tutorial to get me started with this.
Thanks guys!Paul wrote:
> I currently use Dreamweaver MX, ASP, MS Access & VBScript - but apparently I
> need to get something more stable -
> I have been told that the best option would be MS SQL2000 - however, I
> really don't know where to start.
> Can anybody point me in the right direction of a "simple" step by step
> tutorial to get me started with this.
> Thanks guys!
What makes you think that the data storage is the cause of the stability
problems? What types of problems are you having? Honestly, given that
mix of web code, I'd bet $1 that the stability issues reside in the code
and not in your database. Before you make the drastic and expensive
switch to SQL server, I recommend you do some additional research into
your problem.
Zach|||Hi Zach
Thanks for the reply
Basically, we have had a few problems with the database going corrupt on us
as well as the speed issue-
As I only want to develop the website ive been told that I only need to get
the Microsoft Desktop Engine (rather than the Server package itself), or I
could manage it via MS Access (ODBC)
Is this correct?
Thanks again
"Zach Wells" <individual_news@.nibsworld.com> wrote in message
news:2gc868F12nd1U1@.uni-berlin.de...
> Paul wrote:
> > I currently use Dreamweaver MX, ASP, MS Access & VBScript - but
apparently I
> > need to get something more stable -
> > I have been told that the best option would be MS SQL2000 - however, I
> > really don't know where to start.
> > Can anybody point me in the right direction of a "simple" step by step
> > tutorial to get me started with this.
> > Thanks guys!
> What makes you think that the data storage is the cause of the stability
> problems? What types of problems are you having? Honestly, given that
> mix of web code, I'd bet $1 that the stability issues reside in the code
> and not in your database. Before you make the drastic and expensive
> switch to SQL server, I recommend you do some additional research into
> your problem.
> Zach|||Paul wrote:
> Hi Zach
> Thanks for the reply
> Basically, we have had a few problems with the database going corrupt on us
> as well as the speed issue-
> As I only want to develop the website ive been told that I only need to get
> the Microsoft Desktop Engine (rather than the Server package itself), or I
> could manage it via MS Access (ODBC)
> Is this correct?
> Thanks again
Yes, MSDE would be a cheaper alternative. I honestly don't know a whole
lot about it so I don't know what kind of licensing issues you'll run
into when using it for a web back-end.
Zach
Monday, March 12, 2012
Newbie login failed
I'm sorry if this has been asked and answered elsewhere. I'm a complete newbie and I need a bit of hand holding...
I've tried setting up a basic databound datagrid using the MSDE SQL server. I get a login Failed error when I try to display the page in the browser inside VS.NET 2003. I don't get any errors until I actually try to preview the page in the browser. Sorry for the long post below... which is the full error message. What, from what you see, can I do to fix this?
Please be forewarned that I have never used MSDE before or SQL server for that matter (I'm a MySQL guy making the switch!). For that reason I am a little confused about this error because I thought everything was ok because in Visual Studio the DataAdapter previewed with no errors and there were no build errors. I was able to drag the authors table over from the Northwind db, create a dataset and fill it from its dataAdapter.
Server Error in '/asp-practice' Application.
Login failed for user 'PHILIP\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'PHILIP\ASPNET'.
Source Error:
Line 134: 'Put user code to initialize the page hereLine 135: If Not Page.IsPostBack ThenLine 136: SqlDataAdapter1.Fill(AuthorsDS1)Line 137: DataBind()Line 138:
Source File: c:\inetpub\wwwroot\asp-practice\WebForm1.aspx.vb Line: 136
Stack Trace:
[SqlException: Login failed for user 'PHILIP\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44 System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38 asp_practice.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\asp-practice\WebForm1.aspx.vb:136 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032your connection string appears to be set to use integrated authentication (i.e. the credentials of the current user)
while developing, the current user is you: 'PHILIP\yourLogin'
when the web page runs however, the user account that is used is ASPNET
ie: ('PHILIP\ASPNET')
the ASPNET account needs to be given access to your SQL database.|||I have the same error, but I use SQLExpress Server.
It hasn't any GUI.
How can I set ASPNET user for SQLExpress server and which password have I to use?
NewBie Here: Need Help Please (SQLCommand)
Hi Guyz, im currently studying asp.net, i need a code that retrive data from SQL database and post it using Label (web from), i dont know how to do it, need help... Thanks in advance !!!!
Hi There,
First of all import sqlclient namespace
using System.Data.SqlClient;
Read data from sql database and set value to Label1 and Label2
protectedvoid Page_Load(object sender,EventArgs e){
// Create database connection
SqlConnection connection =newSqlConnection("YourConnectionString");// Create instance of command
SqlCommand command =newSqlCommand("Select Field1, Fields2 From TableName", connection);// Open database connection
command.Connection.Open();
// Execute command and get datareader
System.Data.SqlClient.SqlDataReader datareader = command.ExecuteReader();// Check whether or not datareader has soemthing
if (datareader.Read()){
Label1.Text = datareader.GetString(0);// get Field1
Label2.Text = datareader.GetString(1);// get Field2
}
// Close database connection
command.Connection.Close();
}
Newbie here with a newbie error - Getting Database ... already exists.
Hi there
I sorry if I have placed this query in the wrong place.
I'm getting to grips with ASP.net 2, slowly but surely!
When i try to access my site which uses a Sql Server 2005 express DB i am receiving the following error:
Server Error in '/jarebu/site1' Application.
Database 'd:\hosting\member\asanga\App_Data\ASPNETDB.mdf' already exists.
Could not attach file 'd:\hosting\member\jarebu\site1\App_Data\ASPNETDB.MDF' as database 'ASPNETDB'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Database 'd:\hosting\member\asanga\App_Data\ASPNETDB.mdf' already exists.
Could not attach file 'd:\hosting\member\jarebu\site1\App_Data\ASPNETDB.MDF' as database 'ASPNETDB'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:
[SqlException (0x80131904): Database 'd:\hosting\member\asanga\App_Data\ASPNETDB.mdf' already exists.Could not attach file 'd:\hosting\member\jarebu\site1\App_Data\ASPNETDB.MDF' as database 'ASPNETDB'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735075 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +41 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
This is the connection string that I am using:
<connectionStrings>
<addname="ConnectionString"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;Initial Catalog=ASPNETDB;User Instance=True"providerName="System.Data.SqlClient"/>
</connectionStrings>
The database is definitly in the folder that the error message relates to.
What I'm finding confusing is that the connection string seems to be finding "aranga"s database.
Is it something daft?
Many thanks.
James
If you used the ASP.NET configiration manager it will of created the ASPNETDB.MDF database automatically in your App_Data folder but it will be hidden, so either un-hide and delete the previous one or rename your new DB and change your connection string.Newbie help: SQL Server does not exist or access denied
SQL Server does not exist or access denied
I am using SQL Server 2000 and Win2K. Any idea what may be causing this error?What are you supplying for your connection string?
1) SQL Server name
2) Username
3) Password
4) Database
If you use a trusted connection remember that the ASP page will connect to SQL Server as the user account that IIS is running under.|||Hi,
I am getting the same error message:
"SQL Server does not exist or access denied"
when I attempt to register a SQL Server in SQL Server 2000.
Any ideas?
Thanks,
Chris|||'csf' can you ping the server from your workstation
c:\> ping MyServer
I have a feeling that you can not see the server by its user friendly name. Can you ping it by it's IP address.
c:\ ping xxx.xxx.xxx.xxx
If so, then use the Client Network Utility for SQL Server and define an Alias to this server. Set the network library to TCP/IP, set the server alias name to the server name and enter the IP address for the server name.|||Thanks for the reply.
I will try this when I get home this evening :)
Monday, February 20, 2012
Newbie - ? on MsSQL
I had ms sql server 2000 in my PC. I am very new to ASP.NET as i have been working on PHP n MySQL for the past 3 years. Now i am moving to .NET framework 2. I installed visual studio express 2005 and then sql server 2005.
But now that i run sql 2000, it does connect me to localhost. but on sql 2005 i cant. can some one shade some light to this.
I have not used SQL server before and am just starting to learn it with ASP.NET 2. I am programmer that likes to code each and every line of codes but ASP.NET is a bit different. Well anyway, cheers
newbe ? re:date format
Thanks
RaifSQL Server dates are stored as numeric values that interpreted as dates with time of day. Formatting of output should be handled by your user interface, not the database server.|||Thanks I sort suspected that as I started writing the post.
Thanks again|||Go with a smalldatetime in the sql table so that you are only using a (4). The go with a .ToString() and something like this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimeclasstostringtopic4.asp
Hope it helps.|||If you're doing straight SELECT from your ASP, you can use CONVERT(char(10), <your_date_field>, 101) on your date/time field.