显示标签为“connectionstring”的博文。显示所有博文
显示标签为“connectionstring”的博文。显示所有博文

2012年3月27日星期二

Anyone know why this isnt working...?

I am using the following C#... SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class loader = new SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class(); loader.ConnectionString = "PROVIDER=SQLOLEDB; Server=(local); database=TestDB; user id=test; password=password"; loader.ErrorLogFile = "C:\log.txt"; loader.SchemaGen = true; loader.SGDropTables = true; loader.CheckConstraints = true; loader.Execute( "C:\xsd.xsd"/* this file below */, "C:\xml.xml" );To generate tables in the database using the following xml schema...(file: xsd.xsd...) My problems is that it doesn't generate the tables and I am following the SQLXML2.0 documentation as closely as possible.Does anyone know what I have to do to get it to generate the tables? Running it doesn't even produce an error.Cheers,Matt.

I forgot to include to include the XML yesterday...

I am using the following C#...

SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class loader = new SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
loader.ConnectionString = "PROVIDER=SQLOLEDB; Server=(local); database=TestDB; user id=test; password=password";
loader.ErrorLogFile = "C:\log.txt";
loader.SchemaGen = true;
loader.SGDropTables = true;
loader.CheckConstraints = true;
loader.Execute( "C:\xsd.xsd"/* this file below */, "C:\xml.xml" );

To generate tables in the database using the following xml schema... (file: xsd.xsd...)

<?xml version="1.0" standalone="yes"?>
<xs:schema id="PartnerData" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:element name="PartnerData">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="MessageHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="SystemName" type="xs:string" minOccurs="0" />
<xs:element name="CreationDate" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Year" type="xs:string" minOccurs="0" />
<xs:element name="Month" type="xs:string" minOccurs="0" />
<xs:element name="Day" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MessageBody">
<xs:complexType>
<xs:sequence>
<xs:element name="Product" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Manufacturer" type="xs:string" minOccurs="0" />
<xs:element name="Brand" type="xs:string" minOccurs="0" />
<xs:element name="LongDescription" type="xs:string" minOccurs="0" />
<xs:element name="ShortDescription" type="xs:string" minOccurs="0" />
<xs:element name="Category" type="xs:string" minOccurs="0" />
<xs:element name="Family" type="xs:string" minOccurs="0" />
<xs:element name="ProductCode" type="xs:string" minOccurs="0" />
<xs:element name="InformationsUrl" type="xs:string" minOccurs="0" />
<xs:element name="PictureUrl" type="xs:string" minOccurs="0" />
<xs:element name="PublicationDate" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Year" type="xs:string" minOccurs="0" />
<xs:element name="Month" type="xs:string" minOccurs="0" />
<xs:element name="Day" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RecommendedRetailPrice" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="currency" type="xs:string" />
<xs:attribute name="numberOfDecimal" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Characteristics" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Characteristic" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Label" type="xs:string" minOccurs="0" />
<xs:element name="Value" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Arguments" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Argument" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="codeEan" type="xs:string" />
<xs:attribute name="localisation" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema
My problems is that it doesn't generate the tables and I am following the SQLXML2.0 documentation as closely as possible.

Does anyone know what I have to do to get it to generate the tables? Running it doesn't even produce an error.

Cheers,
Matt.

2012年3月11日星期日

Any Timeout setting in ConnectionString of web.config

Hi:

I have some query that takes quite a long time to process in the sql server and every time the page seems to time out.

I wondor is there any Timeout setting that I can defined in the database ConnectionString in web.config file so that I can extend the "wait" time?

Many thanks!

I believe there is:

"integrated security=SSPI;SERVER=YOUR_SERVER;DATABASE=YOUR_DB_NAME;Connect Timeout=45;";

|||

Jason,

I recently had a time out issue with an app after some servers where moved to a centralized location. In my case, the use of the sql server name caused my app to time out as apparently the newly located web server wasn't able to resolve the sql server name in the web.config file fast enough against the WINS server. The solution was to use our sql server's IP address in web.congif file instead of it's name. Then the app ran just fine.

Time outs can definitely be network related. Need to look at that as well as any app configuring.

|||

Unfortunately not Jason. The timeout in the connection string only controls the timeout of the connection (How long the connection will wait before giving up), normally it's irrelevant as you'll get a (fairly) quick negative response.

That said, in your pages where the default 30 second command timeout is too short, in your SqlDataSource_Selecting/Inserting events, the e parameter will have a reference to the actualy SqlCommand object that is about to be used. Set it's timeout. Off the top of my head, I believe it is like:

e.SelectCommand.Timeout=90

That is assuming that you are having the issue with a SqlDataSource. SqlCommand objects have their own timeout parameter that you can set if that is what you are using and having an issue with.

|||

Actually, e.Command.CommandTimeout=90

2012年2月11日星期六

ANSWER: Re: SQLEXPRESS Database Issue - Cannot open database ASPNETDB.MDF requested by the login

Hello Guys

This is my connection string

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; DataBase = ASPNETDB.MDF; User ID = MyWindowsUserName; Password = MyWindowsPassword; User Instance = False; Connect Timeout = 30" providerName ="System.Data.SqlClient"/>

I tried to research on the internet and i got a solution on changing the permissions for this database to enable user SystemName/ASPNET, but iam not able to access this ASPNETDB.MDF from SqlServer and if i go to server explorer in vs2005, i dint know where to chage the permissions.

Can anyone help me on this.

Thanks a lot

The ASPNET account needs to have access both to the server and to the ASPNETDB database. It seems you have granted server access to the account, but not database access.

To grant database access, connect to SQL Server using Management Studio and execute the following SQL statements:

use ASPNETDB
go
create user [SystemName\ASPNET]
go

Thanks
Laurentiu

|||

hi,

Thanks for your info abt the adding of aspnet account in the ASPNETDB Db.

I have created a website using VS 2005, and my SQL Server 2005 -STD Edition(NOT SQLEXPRESS). When ever i try to connect to the database i get this following error : Cannot open database ASPNETDB.MDF requested by the login, login failed. Login failed for user DOMAIN|USERNAME.

FYI, I have added my DOMAIN\username in the Security - Logins of the Database. I have also done the user mappings. That screen reads as follows :
1. Master Database -

Still I get this error. Please help me understand that whether any other permissions is required in the database for me.

Thanks

krans001

|||

hi,

I get this error when i try to execute a website just having a DEFAULT.aspx in which i have added a webpartsmanager. the personalization property of the webpartmanager is set to TRUE and USER. The following steps I did:

1. Installed the Microsoft SQL Server Management Studio 9.00.1399.00 ( STANDERD EDITION).

2. from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 installed the aspnet_regsql and followed the steps in installing the aspnetdb database.

In the usermappings i have provided permissions to me "DOMAIN\USERNAME" to the following db: 1. master 2. msdb 3. tempdb 4. aspnetdb

3. in the edit global configuration removed the USER INSTANCE=TRUE from the following
Data Source=.\MSSQLSERVER2005;Initial Catalog=aspnetdb.mdf;Integrated Security=True

4. edited the machine.config file under the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
as
<add name="LocalSqlServer" connectionString="Data Source=.\MSSQLSERVER2005;Initial Catalog=aspnetdb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />

After doing this i tried to execute the website that i have created which holds a default.aspx page in which i have the webpartmanager. I just wanted to view this file in the browser. As soon as i do this i get this error.

Cannot open database "aspnetdb.mdf" requested by the login. The login failed. Login failed for user 'DOMAIN\USERNAME'.

Thanks in advance for the solution. Please help.. if anyone has a solution please send it immediately to my email id : sriranga.kr@.gmail.com

|||

hi

all i did was removed the .mdf in the connection string and run the same. It works like a charm..

great...

|||

hi sreeksdave

all you need to do is to change the following :

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; DataBase = ASPNETDB.MDF; User ID = MyWindowsUserName; Password = MyWindowsPassword; User Instance = False; Connect Timeout = 30" providerName ="System.Data.SqlClient"/>

AS

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; Initial Catalog= ASPNETDB" providerName ="System.Data.SqlClient"/>

and see how it works..

Do let me know..

Regards

scotty

|||I think this should be rather aspnetdb than aspnetdb.mdf, if you use a user instance you have to specify the filename but with attached database you can just type in the name of the database.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de
|||

Remember that both files ASPNETDB.MDF and aspnetdb_log.LDF are in a folder call App_Data in you project solution, just make sure that you give the right access privileges to your local MACHINE\ASPNET account

Hope this will help

|||

Hi all,

Thanks for all your contribution. It has worked for me and i have also helped few people.

Thanks & Regards

Raaj

|||

Hello Ranga,

Thanks a lot yar.

Hats off

ANSWER: Re: SQLEXPRESS Database Issue - Cannot open database ASPNETDB.MDF requested by the login

Hello Guys

This is my connection string

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; DataBase = ASPNETDB.MDF; User ID = MyWindowsUserName; Password = MyWindowsPassword; User Instance = False; Connect Timeout = 30" providerName ="System.Data.SqlClient"/>

I tried to research on the internet and i got a solution on changing the permissions for this database to enable user SystemName/ASPNET, but iam not able to access this ASPNETDB.MDF from SqlServer and if i go to server explorer in vs2005, i dint know where to chage the permissions.

Can anyone help me on this.

Thanks a lot

The ASPNET account needs to have access both to the server and to the ASPNETDB database. It seems you have granted server access to the account, but not database access.

To grant database access, connect to SQL Server using Management Studio and execute the following SQL statements:

use ASPNETDB
go
create user [SystemName\ASPNET]
go

Thanks
Laurentiu

|||

hi,

Thanks for your info abt the adding of aspnet account in the ASPNETDB Db.

I have created a website using VS 2005, and my SQL Server 2005 -STD Edition(NOT SQLEXPRESS). When ever i try to connect to the database i get this following error : Cannot open database ASPNETDB.MDF requested by the login, login failed. Login failed for user DOMAIN|USERNAME.

FYI, I have added my DOMAIN\username in the Security - Logins of the Database. I have also done the user mappings. That screen reads as follows :
1. Master Database -

Still I get this error. Please help me understand that whether any other permissions is required in the database for me.

Thanks

krans001

|||

hi,

I get this error when i try to execute a website just having a DEFAULT.aspx in which i have added a webpartsmanager. the personalization property of the webpartmanager is set to TRUE and USER. The following steps I did:

1. Installed the Microsoft SQL Server Management Studio 9.00.1399.00 ( STANDERD EDITION).

2. from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 installed the aspnet_regsql and followed the steps in installing the aspnetdb database.

In the usermappings i have provided permissions to me "DOMAIN\USERNAME" to the following db: 1. master 2. msdb 3. tempdb 4. aspnetdb

3. in the edit global configuration removed the USER INSTANCE=TRUE from the following
Data Source=.\MSSQLSERVER2005;Initial Catalog=aspnetdb.mdf;Integrated Security=True

4. edited the machine.config file under the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
as
<add name="LocalSqlServer" connectionString="Data Source=.\MSSQLSERVER2005;Initial Catalog=aspnetdb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />

After doing this i tried to execute the website that i have created which holds a default.aspx page in which i have the webpartmanager. I just wanted to view this file in the browser. As soon as i do this i get this error.

Cannot open database "aspnetdb.mdf" requested by the login. The login failed. Login failed for user 'DOMAIN\USERNAME'.

Thanks in advance for the solution. Please help.. if anyone has a solution please send it immediately to my email id : sriranga.kr@.gmail.com

|||

hi

all i did was removed the .mdf in the connection string and run the same. It works like a charm..

great...

|||

hi sreeksdave

all you need to do is to change the following :

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; DataBase = ASPNETDB.MDF; User ID = MyWindowsUserName; Password = MyWindowsPassword; User Instance = False; Connect Timeout = 30" providerName ="System.Data.SqlClient"/>

AS

<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True; Initial Catalog= ASPNETDB" providerName ="System.Data.SqlClient"/>

and see how it works..

Do let me know..

Regards

scotty

|||I think this should be rather aspnetdb than aspnetdb.mdf, if you use a user instance you have to specify the filename but with attached database you can just type in the name of the database.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de|||

Remember that both files ASPNETDB.MDF and aspnetdb_log.LDF are in a folder call App_Data in you project solution, just make sure that you give the right access privileges to your local MACHINE\ASPNET account

Hope this will help

|||

Hi all,

Thanks for all your contribution. It has worked for me and i have also helped few people.

Thanks & Regards

Raaj

|||

Hello Ranga,

Thanks a lot yar.

Hats off