Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Thursday, March 22, 2012

Cannot open user database error message AFTER I connect and log in.

Ok so I'm using the Management Studio Express and was able to log in and get into the database server, but I had to click the "options>>" button and change database I wanted to connect to from <<default>> to my database on the server or else I get the "cannot open user database, login failed" error message.

Then I right click my database and it gives me the "Cannot open user database. Login failed" error message, even though I already connected to the database to login during the connect screen.

Also I'm able to interact with the database using SQL QUERIES in the Management Studio, like adding new tables with it, but if I right click the database and click "add table" I get that error.

What gives? I know I have permission since I was able to log on, and modify the database using SQL queries but if use the GUI I can't use it. I can't even right-click select "properties" without getting that error.

The reason I want to use the GUI is because I want to right click and use the backup feature of the database.

My guess is that Management Studio continues to point to the default database(which gives me that message) after I already logged in, so I have no idea how to change the default database that management studio points to, to the one I do have permission to use.

Thanks in advance.

What's the account you used to connect to SQL Database Engine in Management Studio Express? The 'Default Database' in SQL is a property of login, that means each login has a Default Database which will be accessed when connecting to SQL Server. You can check this property in the Security->login Properties. Just make sure your login has access on its default database.

Tuesday, March 20, 2012

Cannot Open Database. Login Failed.

I am a newbie in sql server and i am creating a web application using VB.NET

I have a button that when i click it will open the database. Heres the code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim sqlConnect As New SqlConnection("integrated security=SSPI;data source=(local)\SQLEXPRESS;persist security info=False;initial catalog = CorporateDB;")

sqlConnect.Open()

End Sub

the problem is when i clicked the button an error will show:

Cannot open database "CorporateDB" requested by the login. The login failed. Login failed for user 'TRANSLTR\ASPNET'.


The CorporateDB is the database. And i don't know where did i got this user 'TRANSLTR/ASPNET' My computer name is Transltr but not 'TRANSLTR/ASPNET'.

I tried using this connection string in creating windows application in VS.NET. It works fine. What did i missed here. Please i need your help.

ASPNET = Windows Authentication. You need to configure a generic SQL Authentication or use your own. Either way you have to change your connection string to the following format:

Data Source=ServerName;Initial Catalog=DataBaseName3;UId=UserLoginName;Password=Password;Trusted_Connection=False"

You can also use impersonation in the your web.config file. It's up to you.

Adamus

|||Can you show me the steps on:

1. How can i configure a generic SQL Authentication

2. using inpersonation web.config

I apologize for all this trouble. I'm still a newbie in ms sql. Thanks for replying.
|||

Just use the connection string I've posted and put the login and password you use to log into SQL. If you use Windows Authentication, add this line to your web.config file:

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName" password="YourPassword" />
</system.web>

Adamus

sql

Friday, February 10, 2012

cannot find page when generating the report

I click a button to preview the report. The link is

http://localhost/rpt/report_order_summary_cust&rs:Command=Render&rc:Parameters=False&cust_code=cctest&supp_code=%&from_date=2005/01/01&to_date=2007/01/01

I got two file in the rpt folder. they are named as report_order_summary_cust.rdl.data and report_order_summary_cust.rdl.

I wrote a function to generate the report which is

1const string RS_NAME ="report_order_summary_cust";2const string RS_CMD ="&rs:Command=Render&rc:Parameters=False";3string rs_para;4string rs_url;56//parameters7string para_cust_code = lblSelectedCustCode.Text;8string para_supp_code = ddl_supplier.SelectedValue;9string para_from_date = txtFromDate.Text;10string para_to_date = txtToDate.Text;111213RSPath = rtn_http_dir(RSPath);14para_from_date = Convert_date(para_from_date);15para_to_date = Convert_date(para_to_date);161718string[] arr_cust_code = para_cust_code.Split(';');1920for (int index=0; index < arr_cust_code.Length; index++)21{22string cust_code = arr_cust_code[index].ToString().Trim();23rs_para ="&cust_code="+ cust_code +24"&supp_code="+ para_supp_code +25"&from_date="+ para_from_date +26"&to_date=" + para_to_date ;27rs_url = RSPath + RS_NAME + RS_CMD + rs_para;282930string script ="<SCRIPT LANGUAGE='JAVASCRIPT'> window.open('" + rs_url +"','_blank','height=700, width=1050, top=0,left=0,toolbar=no,menubar=no, scrollbars=yes, location=no, status=no');</SCRIPT>";31Page.RegisterStartupScript("Script_" + index.ToString(), script);3233}

When i click the button the above code will be run. However, the pop up windows show that the page cannot be found. I would like to know what problem it is? (I am now to reporting service)

I am using vs2003 + server 2000 reporting service

Thank you.

have you tried url encoding the link. Those dates could cause you problems.