Showing posts with label webpage. Show all posts
Showing posts with label webpage. Show all posts

Friday, February 24, 2012

Connection String Problem : Quantasoft !

Hello ! i just thought to give it a try to see if it works or not!, i made a webpage inC# and it worked fine on my computer but when i uploaded on the internet i got error !!.- SERVER "/" error - runtime error .!!!. then I tested it without any database and found it to work fine ! but when i do any database connectivity my webpage gives errors on the internet !!.. So i got that there is a PROBLEM IN CONNECTION STRING.

Here is what i did!...... I right-clicked the APP_DATA and added a DATABASE named TEST.MDF. Then i added a TABLE named TEST in TEST.MDF and added some fields. Then i dragged the table to the designer view and thus it created a GRIDVIEW and a SQLDATASOURCE1. Thats it !!. it showed all the fields when i ran it on the computer by pressing F5. !!

Everything Ran fine on my computer ! but when i uploaded the website on the internet it showed runtime errors !!

I created a FREE account in Quantasoft web hosting and they had a condition that says -"MS SQLServer2005 Express Edition only User Instances"- I DONT KNOW WHAT IT MEANS !! so i carried on with the uploading stuff !. after uploading i read that the database should be in the APP_DATA folder and i did it !. then it was written to put my database name and it generated a connection string which was-THIS IS WHAT THEY GAVE ME =:<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;Database=abcd.qsh.in_5f2a2114-ebeb-4252-463a-6b1f8cfc3f14;AttachDBFilename=|DataDirectory|test" /> . BUT i had a different connection string ! and that was -THIS IS WHAT I HAD ALREADY->><addname="testConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/> So i deleted my connection string and replaced it with this string ! but still it didnt worked !!.

WHAT DO I NEED TO DO !? HELP ME.
PLEASE TELL ME HOW TO CONVERT MY CONNECTION STRING !
I also found out one more post relating to my problem please read it because somebody replied about some ASPNETDB i also dont know about aspnetdb!! -http://forums.asp.net/t/1122922.aspx

Also, i viewed some starter kits and they also had a ASPNETDB.mdf and someother.mdf in their APP_DATA folder ! . what is ASPNETDB ??.. Do i also need it ? where do i make it or get it !? please explain all about this! i dont know anything about this !

Thanks in advance.

Hi ashutosh508,

ASPNETDB is introduced from asp.net 2.0 and is used to manage profiles/membersips/roles/etc, you can access it from your web site administration tool. Generally speaking, if you do not implement profiles/membership/roles features in your application, you do not need to build this database(actually this database can also be build automatically).

THIS IS WHAT THEY GAVE ME =:<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;Database=abcd.qsh.in_5f2a2114-ebeb-4252-463a-6b1f8cfc3f14;AttachDBFilename=|DataDirectory|test" /> . BUT i had a different connection string ! and that was -THIS IS WHAT I HAD ALREADY->><addname="testConnectionString1"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>

I think your connection string is correct and the one they provided you is wrong. Based on my understanding, since we have specified to use AttachDBfile automatically, we cannot specify theDatabase name--actually i think the database name will be generated automatically after the database file(mdf) is attached.

Any way, you need to consult your web hosting company for more details. Hope my suggestion helps

Sunday, February 19, 2012

Connection string for big uploading files

I have a webpage where I want to upload pdf files to my database (arround 2 MB). Putting them inside the database is the choice based on audit definitions the client has.

The problem is that for big file uploads, I get the "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."error.

I believe the solution is expanding the connection timeout time in the SQL connection. But I don't want to do that in web.config, as a small timeout is good for every page except this one.

What I was thinking about was something like, on button command:

- "create new connection string"

- use that connection string to upload the file using the datatables and tableadapters

- turn back to the default connection string.

How do I explicitly tell the system to "use THIS connection string on the next task" ?

Alternatively, another way of doing is also appreciated!

Doesn't sound like a database timeout. However, if it were, then you control the command timeout on the sqlcommand object, not the sqlconnection. It has nothing to do with the connection string.|||

How do you access the sqlcommand object? Because I do not explicitly declare any sqlcommand, open, close, etc; I declare a TableAdapter object, a DataTable Object and then access the query method of that datatable, so basically two lines to execute the query (that is actually in a tableadapter in app_code). How can one change the command timeout using this method?

|||No idea, I never use table adapters. IMHO they suck, and serve no real purpose other than to try and abstract out something that isn't that hard to begin with. If you want something done right...|||

In the Solution Explorer, go toyourDataSet.xsd->openyourDataSet.Designer.cs, then locate the TableAdapter class, you'll see it has a member like:

private System.Data.SqlClient.SqlCommand[] _commandCollection;

Then in some event (may be InitCommandCollection) you can set the property of the SqlCommands, for example:

private void InitCommandCollection() {
this._commandCollection = new System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate," +
" ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, \r\n " +
" ShipPostalCode, ShipCountry\r\nFROM Orders";
this._commandCollection[0].CommandType = System.Data.CommandType.Text;
this._commandCollection[0].CommandTimeout = 6000;
}

Tuesday, February 14, 2012

Connection question about using impersonate in webpage

Hi,
I create a webservice and impersonate a specific user only when you run a
connection to sql server to insert the data.
My connection string is as follows:
Integrated Security=SSPI;Persist Security Info=false;Initial
Catalog=cmcMail;Data Source=MASDD1;Network Library=dbmssocn;Packet Size=1024;
I got the error during debugging which is "Error: 18456, Severity: 14,
State: 11" . It means that "Valid login but server access failure"
After running some testings, I have a few questions about the inpersonate
issue:
1. If I user anohter domain user, who has access right to server and
database even to execute the store procedure as same as the specific user.
The data is inserted without problem. Why one can work and another cann't?
2. I tried to user the user is not my database user but can access another
database on the same SQL server.
It didn't raise error, and the data is insert on the table. Why this user
without premission can execute the store procedure.
Thanks
"BMW" wrote:

> Hi,
> I create a webservice and impersonate a specific user only when you run a
> connection to sql server to insert the data.
> My connection string is as follows:
> Integrated Security=SSPI;Persist Security Info=false;Initial
> Catalog=Mail;Data Source=MAS;Network Library=dbmssocn;Packet Size=1024;
> I got the error during debugging which is "Error: 18456, Severity: 14,
> State: 11" . It means that "Valid login but server access failure"
>
> After running some testings, I have a few questions about the inpersonate
> issue:
> 1. If I user anohter domain user, who has access right to server and
> database even to execute the store procedure as same as the specific user.
> The data is inserted without problem. Why one can work and another cann't?
> 2. I tried to user the user is not my database user but can access another
> database on the same SQL server.
> It didn't raise error, and the data is insert on the table. Why this user
> without premission can execute the store procedure.
> Thanks
>

Connection question about using impersonate in webpage

Hi,
I create a webservice and impersonate a specific user only when you run a
connection to sql server to insert the data.
My connection string is as follows:
Integrated Security=SSPI;Persist Security Info=false;Initial
Catalog=cmcMail;Data Source=MASDD1;Network Library=dbmssocn;Packet Size=1024
;
I got the error during debugging which is "Error: 18456, Severity: 14,
State: 11" . It means that "Valid login but server access failure"
After running some testings, I have a few questions about the inpersonate
issue:
1. If I user anohter domain user, who has access right to server and
database even to execute the store procedure as same as the specific user.
The data is inserted without problem. Why one can work and another cann't?
2. I tried to user the user is not my database user but can access another
database on the same SQL server.
It didn't raise error, and the data is insert on the table. Why this user
without premission can execute the store procedure.
Thanks"BMW" wrote:

> Hi,
> I create a webservice and impersonate a specific user only when you run a
> connection to sql server to insert the data.
> My connection string is as follows:
> Integrated Security=SSPI;Persist Security Info=false;Initial
> Catalog=Mail;Data Source=MAS;Network Library=dbmssocn;Packet Size=1024;
> I got the error during debugging which is "Error: 18456, Severity: 14,
> State: 11" . It means that "Valid login but server access failure"
>
> After running some testings, I have a few questions about the inpersonate
> issue:
> 1. If I user anohter domain user, who has access right to server and
> database even to execute the store procedure as same as the specific user.
> The data is inserted without problem. Why one can work and another cann't?
> 2. I tried to user the user is not my database user but can access another
> database on the same SQL server.
> It didn't raise error, and the data is insert on the table. Why this user
> without premission can execute the store procedure.
> Thanks
>