Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Wednesday, March 7, 2012

Error with sqlxml and ServerXMLHTTP

After I installed windows 2003 sp1 in the server with iis the asp pages that
use the object "MSXML2.ServerXMLHTTP.3.0" and SQLXML 3.0 with sp1 started to
return errors:
ERROR: 400.100 Bad Request
HResult: 0x80004005
Source: Microsoft SQL isapi extension
Description: Query not specified
The code used is like this one:
<%@.language="VBScript"%>
<%
Response.Expires = 0
Response.CacheControl = "private"
Response.Buffer = True
dim objXMLDocument, vTabela
dim objSrvHTTP, sXml
dim vXMLTemplate
'this is the path of the virtual directory mangead by sqlxml 3.0
sXml = "http://s3iapps.tcontas.pt/gent"
vXMLTemplate = "<GENT xmlns:sql=""urn:schemas-microsoft-com:xml-sql""
sql:xsl=""forms/ResultadoPesqDel.xsl""><sql:query>exec usp_pesq_entidade
@.Colunas ='1010000100', @.Argumentos1 ='Design_Abrev like ''%cml%'' AND Estado
= ''A''',@.Argumentos2 ='',@.Argumentos3 ='', @.Descricao ='(sem descri??o)',
@.Funcionario =461, @.Gravar = 0,
@.vNomeTabela='0687972767815343'</sql:query></GENT>"
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
set objXMLDocument = Server.CreateObject ("MSXML2.DOMDocument.3.0")
objXMLDocument.loadXML vXMLTemplate
objSrvHTTP.setTimeouts 0, 0, (15 * 1000000), (15 * 1000000)
objSrvHTTP.open "POST",sXml, false
objSrvHTTP.setRequestHeader "Content-Type", "application/xml"
objSrvHTTP.send objXMLDocument
Response.ContentType = "text/html"
Response.CharSet = "iso-8859-1"
Response.Write objSrvHTTP.responseText
%>
Any help is welcome,
thanks in advance
Joao Carlos
Which version of the OS did you upgrade from?
Also, you may want to check out SQLXML 3.0 SP3 - the latest and greatest
version of SQLXML 3.0 from
http://www.microsoft.com/downloads/d...displaylang=en
Thanks,
Adam Wiener [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
"jcc" <jcc@.discussions.microsoft.com> wrote in message
news:DA9E6B50-EDE2-443B-9949-001CEE4C30F6@.microsoft.com...
> After I installed windows 2003 sp1 in the server with iis the asp pages
that
> use the object "MSXML2.ServerXMLHTTP.3.0" and SQLXML 3.0 with sp1 started
to
> return errors:
> ERROR: 400.100 Bad Request
> HResult: 0x80004005
> Source: Microsoft SQL isapi extension
> Description: Query not specified
>
> The code used is like this one:
> <%@.language="VBScript"%>
>
> <%
> Response.Expires = 0
> Response.CacheControl = "private"
> Response.Buffer = True
> dim objXMLDocument, vTabela
> dim objSrvHTTP, sXml
> dim vXMLTemplate
> 'this is the path of the virtual directory mangead by sqlxml 3.0
> sXml = "http://s3iapps.tcontas.pt/gent"
> vXMLTemplate = "<GENT xmlns:sql=""urn:schemas-microsoft-com:xml-sql""
> sql:xsl=""forms/ResultadoPesqDel.xsl""><sql:query>exec usp_pesq_entidade
> @.Colunas ='1010000100', @.Argumentos1 ='Design_Abrev like ''%cml%'' AND
Estado
> = ''A''',@.Argumentos2 ='',@.Argumentos3 ='', @.Descricao ='(sem descrio)',
> @.Funcionario =461, @.Gravar = 0,
> @.vNomeTabela='0687972767815343'</sql:query></GENT>"
> set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> set objXMLDocument = Server.CreateObject ("MSXML2.DOMDocument.3.0")
> objXMLDocument.loadXML vXMLTemplate
> objSrvHTTP.setTimeouts 0, 0, (15 * 1000000), (15 * 1000000)
> objSrvHTTP.open "POST",sXml, false
> objSrvHTTP.setRequestHeader "Content-Type", "application/xml"
> objSrvHTTP.send objXMLDocument
> Response.ContentType = "text/html"
> Response.CharSet = "iso-8859-1"
> Response.Write objSrvHTTP.responseText
> %>
>
> Any help is welcome,
> thanks in advance
> Joao Carlos

Error with sqlxml and ServerXMLHTTP

After I installed windows 2003 sp1 in the server with iis the asp pages that
use the object "MSXML2.ServerXMLHTTP.3.0" and SQLXML 3.0 with sp1 started to
return errors:
ERROR: 400.100 Bad Request
HResult: 0x80004005
Source: Microsoft SQL isapi extension
Description: Query not specified
The code used is like this one:
<%@.language="VBScript"%>
<%
Response.Expires = 0
Response.CacheControl = "private"
Response.Buffer = True
dim objXMLDocument, vTabela
dim objSrvHTTP, sXml
dim vXMLTemplate
'this is the path of the virtual directory mangead by sqlxml 3.0
sXml = "http://s3iapps.tcontas.pt/gent"
vXMLTemplate = "<GENT xmlns:sql=""urn:schemas-microsoft-com:xml-sql""
sql:xsl=""forms/ResultadoPesqDel.xsl""><sql:query>exec usp_pesq_entidade
@.Colunas ='1010000100', @.Argumentos1 ='Design_Abrev like ''%cml%'' AND Estad
o
= ''A''',@.Argumentos2 ='',@.Argumentos3 ='', @.Descricao ='(sem descri??o)',
@.Funcionario =461, @.Gravar = 0,
@.vNomeTabela='0687972767815343'</sql:query></GENT>"
set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
set objXMLDocument = Server.CreateObject ("MSXML2.DOMDocument.3.0")
objXMLDocument.loadXML vXMLTemplate
objSrvHTTP.setTimeouts 0, 0, (15 * 1000000), (15 * 1000000)
objSrvHTTP.open "POST",sXml, false
objSrvHTTP.setRequestHeader "Content-Type", "application/xml"
objSrvHTTP.send objXMLDocument
Response.ContentType = "text/html"
Response.CharSet = "iso-8859-1"
Response.Write objSrvHTTP.responseText
%>
Any help is welcome,
thanks in advance
Joao CarlosWhich version of the OS did you upgrade from?
Also, you may want to check out SQLXML 3.0 SP3 - the latest and greatest
version of SQLXML 3.0 from
http://www.microsoft.com/downloads/...&displaylang=en
Thanks,
Adam Wiener [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
"jcc" <jcc@.discussions.microsoft.com> wrote in message
news:DA9E6B50-EDE2-443B-9949-001CEE4C30F6@.microsoft.com...
> After I installed windows 2003 sp1 in the server with iis the asp pages
that
> use the object "MSXML2.ServerXMLHTTP.3.0" and SQLXML 3.0 with sp1 started
to
> return errors:
> ERROR: 400.100 Bad Request
> HResult: 0x80004005
> Source: Microsoft SQL isapi extension
> Description: Query not specified
>
> The code used is like this one:
> <%@.language="VBScript"%>
>
> <%
> Response.Expires = 0
> Response.CacheControl = "private"
> Response.Buffer = True
> dim objXMLDocument, vTabela
> dim objSrvHTTP, sXml
> dim vXMLTemplate
> 'this is the path of the virtual directory mangead by sqlxml 3.0
> sXml = "http://s3iapps.tcontas.pt/gent"
> vXMLTemplate = "<GENT xmlns:sql=""urn:schemas-microsoft-com:xml-sql""
> sql:xsl=""forms/ResultadoPesqDel.xsl""><sql:query>exec usp_pesq_entidade
> @.Colunas ='1010000100', @.Argumentos1 ='Design_Abrev like ''%cml%'' AND
Estado
> = ''A''',@.Argumentos2 ='',@.Argumentos3 ='', @.Descricao ='(sem descrio)',
> @.Funcionario =461, @.Gravar = 0,
> @.vNomeTabela='0687972767815343'</sql:query></GENT>"
> set objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
> set objXMLDocument = Server.CreateObject ("MSXML2.DOMDocument.3.0")
> objXMLDocument.loadXML vXMLTemplate
> objSrvHTTP.setTimeouts 0, 0, (15 * 1000000), (15 * 1000000)
> objSrvHTTP.open "POST",sXml, false
> objSrvHTTP.setRequestHeader "Content-Type", "application/xml"
> objSrvHTTP.send objXMLDocument
> Response.ContentType = "text/html"
> Response.CharSet = "iso-8859-1"
> Response.Write objSrvHTTP.responseText
> %>
>
> Any help is welcome,
> thanks in advance
> Joao Carlos

Error with membersip and roles Cannot resolve the collation conflict between

I'm getting the following errors when trying to execute the following script on the server, its part of the standard asp.net membership and roles, anybody have any ideas how I get get round this?

Msg 468,Level 16, State 9,Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 50Cannot resolve the collation conflictbetween "SQL_Latin1_General_CP1_CI_AS"and "Latin1_General_CI_AS"in the equalto operation.Msg 468,Level 16, State 9,Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 58Cannot resolve the collation conflictbetween "SQL_Latin1_General_CP1_CI_AS"and "Latin1_General_CI_AS"in the equalto operation.Msg 468,Level 16, State 9,Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 84Cannot resolve the collation conflictbetween "SQL_Latin1_General_CP1_CI_AS"and "Latin1_General_CI_AS"in the equalto operation.Msg 468,Level 16, State 9,Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 92Cannot resolve the collation conflictbetween "SQL_Latin1_General_CP1_CI_AS"and "Latin1_General_CI_AS"in the equalto operation.

/****** Object: StoredProcedure [dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles] Script Date: 05/20/2007 11:23:33 ******/SET ANSI_NULLSONGOSET QUOTED_IDENTIFIEROFFGOIFNOT EXISTS (SELECT *FROM sys.objectsWHEREobject_id =OBJECT_ID(N'[dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles]')AND typein (N'P', N'PC'))BEGINEXEC dbo.sp_executesql @.statement = N'CREATE PROCEDURE [dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles]@.ApplicationName nvarchar(256),@.UserNames nvarchar(4000),@.RoleNames nvarchar(4000)ASBEGINDECLARE @.AppId uniqueidentifierSELECT @.AppId = NULLSELECT @.AppId = ApplicationId FROM aspnet_Applications WHERE LOWER(@.ApplicationName) = LoweredApplicationNameIF (@.AppId IS NULL)RETURN(2)DECLARE @.TranStarted bitSET @.TranStarted = 0IF( @.@.TRANCOUNT = 0 )BEGINBEGIN TRANSACTIONSET @.TranStarted = 1ENDDECLARE @.tbNames table(Name nvarchar(256) NOT NULL PRIMARY KEY)DECLARE @.tbRoles table(RoleId uniqueidentifier NOT NULL PRIMARY KEY)DECLARE @.tbUsers table(UserId uniqueidentifier NOT NULL PRIMARY KEY)DECLARE @.Num intDECLARE @.Pos intDECLARE @.NextPos intDECLARE @.Name nvarchar(256)DECLARE @.CountAll intDECLARE @.CountU intDECLARE @.CountR intSET @.Num = 0SET @.Pos = 1WHILE(@.Pos <= LEN(@.RoleNames))BEGINSELECT @.NextPos = CHARINDEX(N'','', @.RoleNames, @.Pos)IF (@.NextPos = 0 OR @.NextPos IS NULL)SELECT @.NextPos = LEN(@.RoleNames) + 1SELECT @.Name = RTRIM(LTRIM(SUBSTRING(@.RoleNames, @.Pos, @.NextPos - @.Pos)))SELECT @.Pos = @.NextPos+1INSERT INTO @.tbNames VALUES (@.Name)SET @.Num = @.Num + 1ENDINSERT INTO @.tbRoles SELECT RoleId FROM dbo.aspnet_Roles ar, @.tbNames t WHERE LOWER(t.Name) = ar.LoweredRoleName AND ar.ApplicationId = @.AppIdSELECT @.CountR = @.@.ROWCOUNTIF (@.CountR <> @.Num)BEGINSELECT TOP 1 N'''', NameFROM @.tbNamesWHERE LOWER(Name) NOT IN (SELECT ar.LoweredRoleName FROM dbo.aspnet_Roles ar, @.tbRoles r WHERE r.RoleId = ar.RoleId)IF( @.TranStarted = 1 )ROLLBACK TRANSACTIONRETURN(2)ENDDELETE FROM @.tbNames WHERE 1=1SET @.Num = 0SET @.Pos = 1WHILE(@.Pos <= LEN(@.UserNames))BEGINSELECT @.NextPos = CHARINDEX(N'','', @.UserNames, @.Pos)IF (@.NextPos = 0 OR @.NextPos IS NULL)SELECT @.NextPos = LEN(@.UserNames) + 1SELECT @.Name = RTRIM(LTRIM(SUBSTRING(@.UserNames, @.Pos, @.NextPos - @.Pos)))SELECT @.Pos = @.NextPos+1INSERT INTO @.tbNames VALUES (@.Name)SET @.Num = @.Num + 1ENDINSERT INTO @.tbUsers SELECT UserId FROM dbo.aspnet_Users ar, @.tbNames t WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = @.AppIdSELECT @.CountU = @.@.ROWCOUNTIF (@.CountU <> @.Num)BEGINSELECT TOP 1 Name, N''''FROM @.tbNamesWHERE LOWER(Name) NOT IN (SELECT au.LoweredUserName FROM dbo.aspnet_Users au, @.tbUsers u WHERE u.UserId = au.UserId)IF( @.TranStarted = 1 )ROLLBACK TRANSACTIONRETURN(1)ENDSELECT @.CountAll = COUNT(*)FROMdbo.aspnet_UsersInRoles ur, @.tbUsers u, @.tbRoles rWHERE ur.UserId = u.UserId AND ur.RoleId = r.RoleIdIF (@.CountAll <> @.CountU * @.CountR)BEGINSELECT TOP 1 UserName, RoleNameFROM @.tbUsers tu, @.tbRoles tr, dbo.aspnet_Users u, dbo.aspnet_Roles rWHERE u.UserId = tu.UserId AND r.RoleId = tr.RoleId AND tu.UserId NOT IN (SELECT ur.UserId FROM dbo.aspnet_UsersInRoles ur WHERE ur.RoleId = tr.RoleId) AND tr.RoleId NOT IN (SELECT ur.RoleId FROM dbo.aspnet_UsersInRoles ur WHERE ur.UserId = tu.UserId)IF( @.TranStarted = 1 )ROLLBACK TRANSACTIONRETURN(3)ENDDELETE FROM dbo.aspnet_UsersInRolesWHERE UserId IN (SELECT UserId FROM @.tbUsers) AND RoleId IN (SELECT RoleId FROM @.tbRoles)IF( @.TranStarted = 1 )COMMIT TRANSACTIONRETURN(0)END 'ENDGO
Any help appreciated thanks, 

What is your database collation set to?

You can check this in MicrosoftSQL Server Management by right clicking the database and selecting "properties".

Now check what collation you have on your aspnet tables. Right click on aspnet_Roles, and select "Script table as","Create to","New query window". Look for the collation settings on each field.

|||

Thank you for your response on the DB I have - Latin1_General_CI_AS

On the table I have -

****** Object:Table [dbo].[aspnet_Roles] Script Date: 05/22/2007 21:28:48 ******/SET ANSI_NULLSONGOSET QUOTED_IDENTIFIERONGOCREATE TABLE [dbo].[aspnet_Roles]([ApplicationId] [uniqueidentifier]NOT NULL,[RoleId] [uniqueidentifier]NOT NULLCONSTRAINT [DF__aspnet_Ro__RoleI__03F0984C]DEFAULT (newid()),[RoleName] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_ASNOT NULL,[LoweredRoleName] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_ASNOT NULL,[Description] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_ASNULL,CONSTRAINT [PK__aspnet_Roles__02084FDA]PRIMARY KEY NONCLUSTERED ([RoleId]ASC)WITH (PAD_INDEX =OFF, IGNORE_DUP_KEY =OFF)ON [PRIMARY])ON [PRIMARY]GOALTER TABLE [dbo].[aspnet_Roles]WITH CHECK ADD CONSTRAINT [FK__aspnet_Ro__Appli__02FC7413]FOREIGN KEY([ApplicationId])REFERENCES [dbo].[aspnet_Applications] ([ApplicationId])GOALTER TABLE [dbo].[aspnet_Roles]CHECK CONSTRAINT [FK__aspnet_Ro__Appli__02FC7413]

So what do I do to fix it?|||

Any body tell me how i can change the collation?

|||

ALTER DATABASE {DatabaseName} COLLATE {NewCollationName}

In this case ALTER DATABASE ASPNETDB COLLATE SQL_Latin1_General_CP1_CI_AS

|||

That worked, thank you.

Sunday, February 26, 2012

Error with asp admin/logins on live server

I have created a site using VWDExpress and now that I've finished testing have moved it over to the server which runs SQLServer 2000. Part of the site requires login, so I created the membership using the ASP.net web configuration tool and when testing locally worked well.

Now though that I've copied the web site over, when I try to log in I get the error:

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

Obviously its some sort of configuration issue, but I don't know what.

What do I have to change to make this work from a test machine to a live server?


Thanks

Have you configured your machine.config and web.config on the live server (where you have SQL Server 2000) to work with SQL Server 2000 because by default it looks for SQL Server 2005?

bullpit

|||

bullpit:

Have you configured your machine.config and web.config on the live server (where you have SQL Server 2000) to work with SQL Server 2000 because by default it looks for SQL Server 2005?

bullpit

I ran through the steps listed here http://msdn2.microsoft.com/en-us/library/aa479307.aspx but it gets to a point and says"The easiest way to have your application take advantage or your newly created database is just to replace he connection string value of this localSQLServer setting in your apps web.config". The problem i have is that i dont know what or how to modify?

Now though Im getting the errorSystem.ArgumentException: Invalid value for key 'attachdbfilename' when i try to access the database even though it appears to point to a valid DB file (i.e.

data source=SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true)

thanks for any assistance

|||

Ok...Lets start from the beginning. What my understanding is that your dev server had SQL Server Express edition and your live server has SQL Server 2000. Now, if you have not changed any configuration settings in config files, heres what you have to do. Make sure you have ASPNETDB in SQL Server 2000. If not, locate aspnet_regsql.exe in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and run it.

Now: Locate machine.config.

If Windows Server 2000 is your live server, then it will be located in C:\WINNT\Microsoft.NET\Framework\v2.0.50727\CONFIG

Modify <connectionStrings> tag like this. I commented the default string just in case it gets messed up. Also, make a copy of machine.config before altering it.

<connectionStrings><!-- <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>--><add name="LocalSqlServer" connectionString="YOUR CONNECTION STRING TO SQL SERVER 2000 ASPNETDB"/> </connectionStrings> Then: add this connectionString in your application web.config file:<add name="LocalSqlServer" connectionString="YOUR CONNECTION STRING TO SQL SERVER 2000 ASPNETDB"/>Add the following tags just before your </system.web> tag<membership> <providers><remove name="AspNetSqlMembershipProvider"/> <add name="AspNetSqlMembershipProvider"type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"connectionStringName="LocalSqlServer"enablePasswordRetrieval="false"enablePasswordReset="true"requiresQuestionAndAnswer="true"applicationName="/YOUR APPLICATION NAME" MAKE SURE TO CHANGE THE NAME TO YOUR APPLICATION NAMErequiresUniqueEmail="false"passwordFormat="Hashed"maxInvalidPasswordAttempts="5"minRequiredPasswordLength="7"minRequiredNonalphanumericCharacters="1"passwordAttemptWindow="10"passwordStrengthRegularExpression="" /> </providers></membership> <profile><providers> <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/"type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers></profile>

Try this and let me know if you are getting anywhere.

Good luck...

bullpit

|||

bullpit:

Make sure you have ASPNETDB in SQL Server 2000. If not, locate aspnet_regsql.exe in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and run it.

Seems as though im falling at the first hurdle then! The database isn't in SQLServer at all, because it was created using the ASP web admin tool and resides in the \app_data\ folder of my site. I have copied this to the server but obviously SQLServer doesn't pick it up. If i run the aspnet_regsql tool then its not in the drop-down list of databases to intialise.

Im not sure how to proceed now to get it in SQLServer 2000.

Thanks for all the help btw.

|||

Lets try this:

Just go thru all the default steps of the wizard, leave the value as <default> in dropdown and click next, verify in the last step that the wizard is creating ASPNETDB. click finish. see if this helps.

good luck...

bullpit

|||

bullpit:

Lets try this:

Just go thru all the default steps of the wizard, leave the value as <default> in dropdown and click next, verify in the last step that the wizard is creating ASPNETDB. click finish. see if this helps.

good luck...

bullpit

It Did, Thanks!I now have a blank aspnetdb showing in SQLServer 2000 and another (populated with users and passwords) in the \app_data folder.

How do i go aobut moving from one to the other?

|||

elDeeJay:

bullpit:

Lets try this:

Just go thru all the default steps of the wizard, leave the value as <default> in dropdown and click next, verify in the last step that the wizard is creating ASPNETDB. click finish. see if this helps.

good luck...

bullpit

It Did, Thanks!I now have a blank aspnetdb showing in SQLServer 2000 and another (populated with users and passwords) in the \app_data folder.

How do i go aobut moving from one to the other?

I should have said,

How do i go about moving from one to the other and getting the membership pages created with the ASP web based management tool to recognise this new database location??

Thanks again

|||

You have to configure web.config and machine.config for that. I have already explained that earlier.

bullpit

|||

bullpit:

You have to configure web.config and machine.config for that. I have already explained that earlier.

bullpit

OK, so I deployed my database using this guide (http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx) and now the SQLServer 'sees' the database. I updated my web.config to point to the database on the server and now the login page loads. However, when i go to login, its telling me the login is rejected, for ALL the users, even though i know the login details are correct.

Also, if the data is in the SQLServer database, but the details are encrypted, how do i go about adding new users etc?

I can't belive the process is this coplex. I would have thought it would know the database is in the \app_data\ folder and copying this over would have been sufficient, whatever host it was running on! :(

|||

Well...copying is not the same is copy-paste operation in Windows plateforms. You have to detach the database and then attach it to the new DBMS. Can you paste your web.config please so that I can see what setting you have?

bullpit

|||Certainly (and i really appreciate the time you are giving up to help btw)

123<!--45 Note: As an alternative to hand editing this file you can use the67 web admin tool to configure settings for your application. Use89 the Website->Asp.Net Configuration option in Visual Studio.1011 A full list of settings and comments can be found in1213 machine.config.comments usually located in1415 \Windows\Microsoft.Net\Framework\v2.x\Config1617-->1819<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">2021 <appSettings/>2223 <connectionStrings>2425 <remove name="LocalSqlServer" />2627 <add name="ENQConnectionString" connectionString="Data Source=WEBSERVER;Initial Catalog=ENQUIRIES;Integrated Security=True" providerName="System.Data.SqlClient" />2829 <add name="LocalSqlServer" connectionString="Data Source=WEBSERVER;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient" />3031 </connectionStrings>3233 <system.web>3435 <globalization culture="en-GB" uiCulture="en-GB" />3637 <roleManager enabled="true" />3839 <authentication mode="Forms" />4041 <pages styleSheetTheme="DataWebControls"/>4243<!--4445 Set compilation debug="true" to insert debugging4647 symbols into the compiled page. Because this4849 affects performance, set this value to true only5051 during development.5253 -->5455 <compilation debug="true" defaultLanguage="c#">5657 <assemblies>5859 <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />6061 <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />6263 <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />6465 </assemblies>6667 </compilation>6869 <customErrors mode="Off"/>7071<!--7273 The <authentication> section enables configuration7475 of the security authentication mode used by7677 ASP.NET to identify an incoming user.7879 -->8081 <!--8283 The <customErrors> section enables configuration8485 of what to do if/when an unhandled error occurs8687 during the execution of a request. Specifically,8889 it enables developers to configure html error pages9091 to be displayed in place of a error stack trace.92939495 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">9697 <error statusCode="403" redirect="NoAccess.htm" />9899 <error statusCode="404" redirect="FileNotFound.htm" />100101 </customErrors>102103 -->104105 <httpHandlers>106107 <remove verb="*" path="*.asmx"/>108109 <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>110111 <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>112113 <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364E35" validate="false"/>114115 </httpHandlers>116 <httpModules>117 </httpModules>118<membership>119120<providers>121122<remove name="AspNetSqlMembershipProvider"/>123124<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"125126connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"127128applicationName="/ETS" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"129130minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />131132</providers>133134</membership>135136<profile>137138<providers>139140<add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />141142</providers>143144</profile>145146</system.web>147148</configuration>149
|||

You are welcome.

Modify the authentication and authorization tags to something like this:

<authentication mode="Forms"><forms name="appNameAuth" path="/" loginUrl="Login.aspx" protection="All" timeout="999999"> </forms></authentication><authorization> <deny users="?" /> </authorization>
good luck.
bullpit

|||

bullpit:

You are welcome.

Modify the authentication and authorization tags to something like this:

<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="Login.aspx" protection="All" timeout="999999">
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
good luck.
bullpit

Thanks, replaced <authentication mode="Forms" /> with the code above but the exact same problem persists.

|||

Now I am not sure what the problem is. For creating users in your database, you can use the ASP.NET configuration tool to create and manage users, roles and other things. For me, for some reason, Create User option does not work, everything else works though. So what I do is add a temporary web page to my application with just a CreateUserWizard control on it, create a user, and then remove it from the project. For everything else, theres Master Card (ASP.NET Tool)

bullpit

Friday, February 24, 2012

Error while using first time!

I'm trying to learn about SQL databases and use them for my asp.net app sine I cant get the hang of MySQL in ASP. Every time I go to create a new SQL Database it saids: Would you like to place it in the App_Data folder basicly and I say yes. Then the error:

Unable to find DbProivderFactory for type System.Data.SqlClient.SqlConnection

Hi Clanstyles,

Based on the error message, I think the provider factory was not installed properly on you machine. Or the configuration files might not be written correctly.

Please try the following:

1. Open machine.config file under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
2. Check the nodes under configuration/system.data/DbProviderFactories to see if all the provider has been installed successfully. It has to look like this.

<DbProviderFactories>
<add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</DbProviderFactories>

HTH.

Sunday, February 19, 2012

Error while running script on host server

I am trying to deploy my database-driven ASP.NET application to my web server. I have hosting through godaddy.com and they require that you run a script through their SQL admin Query Analyzer to create the database. After I attach the database in the Management Studio, I generate the script, copy and paste it into the QA and get the following error. Any help?

Error -2147217900

Line 18: Incorrect syntax near '('.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Students]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Students](
[StudentID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](20) NULL,
[LastName] [nvarchar](20) NULL,
[PhoneNumber1] [nvarchar](15) NULL,
[PhoneNumber2] [nvarchar](15) NULL,
[Instrument] [nchar](20) NULL,
[Interests] [nvarchar](50) NULL,
[Active] [bit] NULL,
[TimeID] [int] NULL,
[UserID] [nchar](20) NULL,
CONSTRAINT [PK_Students] PRIMARY KEY CLUSTERED
(
[StudentID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Lessons]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Lessons](
[LessonID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[CurrentNotes] [nvarchar](250) NULL,
[FutureNotes] [nvarchar](250) NULL,
[DateTime] [datetime] NULL,
[StudentID] [int] NOT NULL,
CONSTRAINT [PK_Lessons] PRIMARY KEY CLUSTERED
(
[LessonID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IFNOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =OBJECT_ID(N'[dbo].[FK_Lessons_Students]') AND parent_object_id =OBJECT_ID(N'[dbo].[Lessons]'))
ALTER TABLE [dbo].[Lessons] WITH CHECK ADD CONSTRAINT [FK_Lessons_Students] FOREIGN KEY([StudentID])
REFERENCES [dbo].[Students] ([StudentID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Lessons] CHECK CONSTRAINT [FK_Lessons_Students]

That's because you the script is generated for a SQL2005 table in Management Studio, so it contains some new elements in SQL2005 which do not exist in SQL2000. Then when you tried to execute it in Query Analyzer (which uses SQL2000 T-SQL rules), QA failed to parse some new T-SQL syntax (I see it is the WITH block following the CONSTRAINT definition here).

For more information about T-SQL enhancement in SQL2005, you can refer to:

http://msdn.microsoft.com/library/en-us/dnsql90/html/sql_05TSQLEnhance.asp?

BTW, system schemas also have been changed in SQL2005, so if you try to refer to 'sys.objects' as in the script in SQL2000, an 'object not exist' error will be raised. For information, please refer to:

http://msdn2.microsoft.com/en-us/library/ms187997.aspx

Error while runnign web appication using Visual studio 2005

Hello,

I have made one application in asp.net using C#. It is running perfect in my visual studio 2005 and also on localhost.

Currently i have installed visual studio 2005 in new PC. Now that application is running fine under Localhost. But it is giving me error when i run

it through visual studio in New PC and the error is

" Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed. "

One more point is that i have used DSN and so i checked the DSN also and it is also correct.

Second thing is I have two directoryadmin anduser.If I run the pages of admin directory then it is running fine. But if i run the page of user directory then it is showing

me the above eror. I have also made different config files for both directory and one general config file for whole directory.

I have also search on google for this problem and they asked me to delete SQLEXPRESS directory from C drive but it is not get deleted and it shows the error that

"it is being used by some other program please try again."

So you might have understood my problem. Please help me to get out of this problem. Thanks a lot for reading my problem.

Regards,

Hardik B.

Well if you're looking to delete that directory, you will probably have to shut down your Mircosoft SQL Server service (control panel -> admin tools -> Services). I'm not sure if that will fix your problem though.. Also, make sure to restart your service after you finish your delete.

Wednesday, February 15, 2012

Error while establishing a connection to the SQL server 2005 - Could not open a connection

Hi,

I had an old web application created during asp.net 1.1 and it have a connection problem with the sql server 2005 when it is mirgrated to a new webserver with dotnet framework 2.0 platform. I have enabled the remote access(TCP/IP and named pipes) in sql server 2005, did all the neccessary things, check whether the TCP/IP is enabled, named pipe is enabled...

I created another web application using VS 2005. The database connection works perfectly well.

This are the connectionString from the old web application.

<appSettings>
<addkey="ConnectionString"value="Server=127.0.0.1;Database=somedb;User id=user; Password=somepassword; Trusted_Connection=False; POOLING=FALSE"/>
</appSettings>

Thankyou in advance!

I am not sure but maybe try this?

<appSettings>
<addk="ConnectionString"value="Server=127.0.0.1;Database=somedb;User id=user; Password=somepassword;"/>
</appSettings>

or

<appSettings>
<addk="ConnectionString"value="workstation id="computername";packet size=4096;data source=yourserver;initial catalog=yourdatabase ;user id=user;password=password"/>
</appSettings>


|||

Thank jpazgier for your help. I have tried and tested it out. However the problem still exist.. =(

|||Could you provide code where you use your connection string? How you read it from config file and how you use it to get data?|||

Hi,

This error message is just a basic connectivity error meaning the client could not connect to the target SQL Server. So just follow the basic connectivity troubleshooting guidelines on our SQL Protocols blog, see:

SQL Server 2005 Connectivity Issue Troubleshoot - Part I
http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx

and

SQL Server 2005 Connectivity Issue Troubleshoot - Part II
http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx
This should help you debug the problem.

Error While DTS Execution from ASP

I ahve created a DTS package & was able to execute it
from backend but while trying to execute DTS Package
created in local Packages in sql client gets error.
Error Number 2147287038T
Error Description :The system cannot find the file
specified.
package Name :FSPETLISASUpload_DevServer1
Code used
set objDTSPackage = Server.CreateObject("DTS.Package")
on error resume next
objDTSPackage.LoadFromSQLServer "Moody", "fspapp", "w4wmm"
,
DTSSQLStgFlag_Default, "", "", "", "FSPETLISASUpload_DevSe
rver1"
Response.Write err.number & err.Description
Thanks in advance
As a test you may want to try the script (change the obvious variables),
contained at the following link:
http://support.microsoft.com/default...b;en-us;252987
Steve
"Aparna" <nandi_aparna@.yahoo.com> wrote in message
news:02d201c49aa1$d1cef530$a401280a@.phx.gbl...
> I ahve created a DTS package & was able to execute it
> from backend but while trying to execute DTS Package
> created in local Packages in sql client gets error.
>
> Error Number 2147287038T
> Error Description :The system cannot find the file
> specified.
> package Name :FSPETLISASUpload_DevServer1
> Code used
> set objDTSPackage = Server.CreateObject("DTS.Package")
> on error resume next
> objDTSPackage.LoadFromSQLServer "Moody", "fspapp", "w4wmm"
> ,
> DTSSQLStgFlag_Default, "", "", "", "FSPETLISASUpload_DevSe
> rver1"
> Response.Write err.number & err.Description
>
> Thanks in advance
>

error while connecting

Hey all,

I am new to ASP.NET. While executing a simple code , i got the error:System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Whats wrong?

Regards

Yasir

Maybe the problem is in your connection string or you don't open database connection when executing data manipulating.Please check this again.If you still have a problem.please paste your code here.

Error while connect to SQL Server using ADO control

The following error happens in my ASP.NET page from time to time. It will disappear after I restart the SQL Server. I guess I messed up in the garbage collection, but I really don't know what to do except using "conn=nothing" statement, can anyone help me with this?

Thanks!

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

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.Runtime.InteropServices.COMException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

Source Error:

Line 39: Public Sub New()Line 40: conn = New ADODB.ConnectionLine 41: conn.Open("Provider=SQLOLEDB.1;Persist Security Info=xxxxx;User ID=xxxxx;Initial Catalog=xxxx;Data Source=xxx")Line 42: rs = New ADODB.RecordsetLine 43: my_UserID = 0

try encasing your db interaction in a using{} block - that way it will make sure that the dispose() method has been called and the objects marked for garbage collection.|||

DWesthead:

try encasing your db interaction in a using{} block - that way it will make sure that the dispose() method has been called and the objects marked for garbage collection.

I am not using C#, I am using VB, do you know the garbage collection using VB?

Thanks!

|||

In VB you can use something like this:

Using connectionAsNew SqlConnection()

connection.ConnectionString = connectionString

connection.Open()

Console.WriteLine("State: {0}", connection.State)
Console.WriteLine("ConnectionString: {0}", _
connection.ConnectionString)
End Using

|||

I tried to do that, but the "Using" tag is not recognized, maybe there is no such a thing as "USING" in VB?

|||

Using works for me:

Using connAsNew SqlConnectionEndUsing

Using turns blue, and when I finish the first line, it inserts the End using statement for me.

Curious, why are you using adodb instead of sqlconnect/sqlcommand?

|||

I am using adodb because I am used to it. I programed several ASP program using adodb.

I think I might not have to most recent asp.net sdk install then, I will try to install it now.

Could you tell me any different from sqlconnection and the adodb connection? how to use sqlconnection?

Thanks!

Alex

|||

They are very similiar. The easiest way to make a correct sqlconnection string is to drop a sqldatasource control on your page, then use the wizardBig Smile

I often do that even for connection strings that I use programmatically, I just tell the wizard to put it in web.config, and after the wizard is done, I'll delete the sqldatasource from the page, and access the connectionstring programmatically.