Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Wednesday, March 21, 2012

I cant connect to my local sql server express db. Please help

Hello,

I need help to connect to my local sql express db in visual studio 2003 in vb.
It currently works with the production db information and I need to test a few things, So i'd like to point it to the local db.


It works this way:
Const CONN_STRING = "server=johndoe;user id=john;password=doe;database=johnd"
Dim conn As SqlConnection = New SqlConnection(Me.CONN_STRING)
conn.Open()

I want to point it to my local db and it doesn't connect.

Dim connectionString As String = "Data Source={myusername\SQLEXPRESS};Initial Catalog=johnd;Trusted_Connection=yes"
Dim conn As SqlConnection = New SqlConnection(connectionString)

Try
conn.Open()
Catch ex As Exception
Response.Write(ex.ToString())
End Try

and even that doesn't work.

When i go to my sql server 2005, it says
MYUSERNAME\SQLEXPRESS (SQL SERVER 9.0.3042 - theworknetwork\myusername

what am i doing wrong ?

Thanks.

You can try two things:

1) If you are an administrator on your local computer, then make sure that your user ID is in the Administrators group and then make that the Administrators group has access to the SQLEXPRESS instance. Change the user ID used by the SQL Server Management Tool with your local machine login, not your network login. If this doesn't work, replace it with the local machine Administrator account.

2) Instead of using Windows authorizations, use SQL Server authorizations. Create a new user in SQL Server specifically for your database. Make this user the dbo. Then use this user name with password in your ConnectionString.

At times, I have issues with Windows users because the passwords are different across the various computers. This has not been the case with SQL Server credentials, which I usually prefer.

Also, try using Integrated_Security in place of Trusted_Connection in the ConnectionString.

|||

Heres what I've tried. I went to that db (johnd), went to the security>users> and there is already a user called dbo

I tried doing Integrated_Security like you said and i got an error saying that is an invalid key. So here is what I have and it still doesn't work.

"Data Source={myusername\SQLEXPRESS};Initial Catalog=intranet;Trusted_Connection=yes;user id=dbo; password=dbo"

Any ideas?


|||

Can you please try with the following connection string if you are using NT Authentication:

Data Source={localmachine\SQLEXPRESS};Initial Catalog=intranet;Trusted_Connection=yes;

If you are using SQL Server User please try with the following connection string:

Data Source={localmachine\SQLEXPRESS};Initial Catalog=intranet;user id=<local sql server user>; password=<password>

Please make sure that you are changing the bold string with appropriate values.

Following URL provides you the steps to create the user:

http://www.microsoft.com/technet/prodtechnol/sql/2005/mgsqlexpwssmse.mspx

|||

I am in microsoft sql server managemen studio Object explorer (on left)
The very first item shows SDAVID\SQLEXPRESS

underneath that i have my database intranet

I then went to security > users [right click] > New User
Under Database User - New,
User Name: SDAVID
Login name
a new window came for Select Login and i found SDAVID [hit okay.]
* so now it shows User name: SDAVID
and login name shows SDAVID

under schemas owned by this user, I choose db_owner and db_securityadmin
under database membership i choose db_owner and db_securityadmin

Now under the code, here is what i have...

Const dbstring = "Data Source={SDAVID\SQLEXPRESS};Initial Catalog=intranet;user id=<sdavid>; password=<sdavid>"


Public Function testConnection()
Dim connectionString As String = "Data Source={SDAVID\SQLEXPRESS};Initial Catalog=intranet;user id=<sdavid>; password=<sdavid>"
Dim conn As SqlConnection = New SqlConnection(ConnectionString)
Dim cmd As SqlCommand = New SqlCommand("selec * from tblUsers", conn)
cmd.CommandType = CommandType.Text
Try
conn.Open()
Catch ex As Exception
Response.Write(ex.ToString())
Finally
conn.Close()
End Try

this generates the following error:
sqlException: Sql server does not exists or access denied.

thanks.

|||

Can you please use the following modified connection string:

Const dbstring = "Data Source=SDAVID\SQLEXPRESS;Initial Catalog=intranet;user id=sdavid; password=sdavid"

|||

Thank you. that did it! ..
Data Source=SDAVID\SQLEXPRESS;Initial Catalog=intranet;Trusted_Connection=yes;

|||

Hey Sri,

I tried it your way with specifying username and password and that did not work. Do you know why this could be ?

in Micrososft Sql Server Mangement Studio, i went to the db, Security > USers and created a user called sdavid with sdavid. I gave the user db_datareader and db_owner an under database roles membership gave it db_owner... i'd like to get the app working sql sever authhentication.

thanks.

Monday, March 19, 2012

I cannot logon to Http://localhost/reports$sqlexpress

Hello,
I am completely stuck. I have installed SQL server express server
advanced with reporting services. I can create some reports in Visual
studio 2005 IDE (from Acces database) but I cannot login to subj
address to do something from the web
I get the following response from my browser:
The server has encountered an error while loading an application
during the processing of your request. Please refer to the event log
for more detail information. Please contact the server administrator
for assistance
What does it mean? I use Windows XP Pro, SP2, using IIS 5.1. IIS is
functioning. I am logged as a user with Administrator rights. I can
browse web pages hosted on my IIS.
Searc on Google on this reveals a lot of hits which I have gone
through but no avail.
Also, how can I check that I have ASP.NET enabled on IIS'
Thanks,
AivarsOn Mar 15, 5:52 pm, "Aivars" <aiva...@.apollo.lv> wrote:
> Hello,
> I am completely stuck. I have installed SQL server express server
> advanced with reporting services. I can create some reports in Visual
> studio 2005 IDE (from Acces database) but I cannot login to subj
> address to do something from the web
> I get the following response from my browser:
> The server has encountered an error while loading an application
> during the processing of your request. Please refer to the event log
> for more detail information. Please contact the server administrator
> for assistance
> What does it mean? I use Windows XP Pro, SP2, using IIS 5.1. IIS is
> functioning. I am logged as a user with Administrator rights. I can
> browse web pages hosted on my IIS.
> Searc on Google on this reveals a lot of hits which I have gone
> through but no avail.
> Also, how can I check that I have ASP.NET enabled on IIS'
> Thanks,
> Aivars
You may need to reinstall SSRS Express w/Advanced Services. I had a
similar issue a few months back and that seemed to resolve it. To
check if ASP.NET is enabled for IIS, do the following:
- Right click 'My Computer' and select 'Manage.'
- Select Services and Applications -> Internet Information Services ->
Default Web Site
- Right-click either the Reports or ReportServer virtual directory and
select Properties.
- There should be a tab at the end called 'ASP.NET'. If you select it,
it will show you the ASP.NET version, etc.
- Also, the Virtual Directory tab is where you would set up connection
pooling (in case you needed to run different versions of Visual
Studio/ASP.NET and need to control which .NET framework is used for
what).
Hope this helps.
Regards,
Enrique Martinez
Sr. ASP.NET/SQL Server Developer|||Running the following statement in your Framework\v2.0.50727 directory
might help:
aspnet_regiis -i -enable
Regards,
Thomas
Aivars schrieb:
> Hello,
> I am completely stuck. I have installed SQL server express server
> <SNIP>
> Also, how can I check that I have ASP.NET enabled on IIS'|||Thanks who responded. I am at dead end - I have reinstalled 5(!!!)
times all SSRS and Toolkit and still I am getting the following error
when logging to reportserver:
The server has encountered an error while loading an application
during the processing of your request. Please refer to the event log
for more detail information. Please contact the server administrator
for assistance.
No clue whatsoever.
Any more ideas?
Aivars
Thomas H=FCtter wrote:
> Running the following statement in your Framework\v2.0.50727 directory
> might help:
> aspnet_regiis -i -enable
> Regards,
> Thomas
>
> Aivars schrieb:
> > Hello,
> > I am completely stuck. I have installed SQL server express server
> > <SNIP>
> > Also, how can I check that I have ASP.NET enabled on IIS'|||Well, what do your event logs say around the time the error happens?
Aivars schrieb:
> Thanks who responded. I am at dead end - I have reinstalled 5(!!!)
> times all SSRS and Toolkit and still I am getting the following error
> when logging to reportserver:
> The server has encountered an error while loading an application
> during the processing of your request. Please refer to the event log
> for more detail information. Please contact the server administrator
> for assistance.|||Thomas, thank you very much.
I reinstalled windows(!). Now i can at least get the to the home page
of reportserver (it looks like it) but it responds with an error:
The report server is not responding. Verify that the report server is
running and can be accessed from this computer. But it is a home page
of report server.
It looks like I am closer. What is that last thing which I am
suppposed to do?
I think that is something to do with windows xp security?
Thanks,
Aivars
Thomas H=FCtter wrote:
> Well, what do your event logs say around the time the error happens?
>
> Aivars schrieb:
> > Thanks who responded. I am at dead end - I have reinstalled 5(!!!)
> > times all SSRS and Toolkit and still I am getting the following error
> > when logging to reportserver:
> >
> > The server has encountered an error while loading an application
> > during the processing of your request. Please refer to the event log
> > for more detail information. Please contact the server administrator
> > for assistance.|||Finally I did get it to work. I had tu use rskeymgmt utility to delete
encrypted contend. And do not ask me why because i do not know myself
how i had something encrypted on server.
maybe when configuring the report server there is an option to encrypt
and i had used it by accident.
Anyway, thanks to all who responded. There is a plethora of
information in Books online and Google is your friend!
Aivars
Aivars wrote:
> Thomas, thank you very much.
> I reinstalled windows(!). Now i can at least get the to the home page
> of reportserver (it looks like it) but it responds with an error:
> The report server is not responding. Verify that the report server is
> running and can be accessed from this computer. But it is a home page
> of report server.
> It looks like I am closer. What is that last thing which I am
> suppposed to do?
> I think that is something to do with windows xp security?
> Thanks,
> Aivars
> Thomas H=FCtter wrote:
> > Well, what do your event logs say around the time the error happens?
> >
> >
> > Aivars schrieb:
> > > Thanks who responded. I am at dead end - I have reinstalled 5(!!!)
> > > times all SSRS and Toolkit and still I am getting the following error
> > > when logging to reportserver:
> > >
> > > The server has encountered an error while loading an application
> > > during the processing of your request. Please refer to the event log
> > > for more detail information. Please contact the server administrator
> > > for assistance.

I cannot create a brand new MDF (sql server database) with Visual Basic 2005

Hi everybody:

I go to Server Explorer, right click on Data Connection, input the server name (that is, my own computer), give a new name to the database to create, and then inevitably get the error window saying:

An error occurred while establishing a connection to the server. When connectiong 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: Named Pipes Provider, error 40, could not open a conection to SQL Server)

So, how to open a connection to SQL server 2005? I looked in the msdn but found absolutely nothing.

Please help

Paolo

There is a great blog post that discusses common causes of connection errors and the errors that you get when that problem exists. This particular error suggests that SQL Express is not running. Launch SQL Server Configuration Manager and verify that the server is running.

Mike

I cannot create a brand new MDF (sql server database) with Visual Basic 2005

Hi everybody:

I go to Server Explorer, right click on Data Connection, input the server name (that is, my own computer), give a new name to the database to create, and then inevitably get the error window saying:

An error occurred while establishing a connection to the server. When connectiong 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: Named Pipes Provider, error 40, could not open a conection to SQL Server)

So, how to open a connection to SQL server 2005? I looked in the msdn but found absolutely nothing.

Please help

Paolo

There is a great blog post that discusses common causes of connection errors and the errors that you get when that problem exists. This particular error suggests that SQL Express is not running. Launch SQL Server Configuration Manager and verify that the server is running.

Mike

I can't find the setting.

Hi, I'm completely new to SQL Server and ASP.NET, so please bear with me on my learning curve! I've installed Visual Web Developer Express and SQL Server Express (on the same PC). I then used Web Developer Express to successfully create a new database with a couple of tables in it. So far so good. I then installed SQL Server Management Studio Express on the same PC and tried to connect to my new database. The connection to the SQL Server instance appears to work OK (using Windows Authentication) but I can't see the database I previously created. All I can see are the System Databases. Does anyone know what the solution might be?

Ensure you are really connected to the same SQL Server instance, you could have multiple instances. Ensure you are connecting using the same credentials, your Windows Authenication account may have different permissions than the account used to by Web Developer Express.

Let me know if this does not help

Peter Saddow

|||

Thank you for the feedback. I eventually found out what the problem was: by default, Web Developer Express creates SQL databases which are visible only to the current User Instance. To disable this, you have to set "User Instance = FALSE" on the database connection string. For example, my original connection string was:

Data Source=.\SQLEXPRESS;AttachDbFilename="S:\My Documents\Visual Studio 2005\WebSites\Db1\App_Data\Database.mdf";Integrated Security=True;User Instance=True

By setting User Instance = False, I can now see the database from SQL Server MSE.

|||I came across the same answer you did the only problem is that I may not find the settings file or some way to edit it.

Monday, March 12, 2012

i am using a stored procedure for paging....

However it is not saving in visual srudio 2005. it is saying 'ambiguous column name ID' does anyone know why?

CREATE PROCEDUREPagedResults_New

(

@.startRowIndexint,

@.maximumRowsint

)

AS

--Create a table variable

DECLARE@.TempItemsTABLE

(

IDint IDENTITY,

ShortListIdint

)

-- Insert the rows from tblItems into the temp. table

INSERT INTO@.TempItems (ShortListId)

SELECTId

FROMShortlist S

WHEREPublish ='True'order by date DESC

-- Now, return the set of paged records

SELECTS.*

FROM@.TempItems t

INNER JOINShortList SON

t.ShortListId = S.Id

WHEREIDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1

Change:

WHEREIDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1

To:

WHERET.IDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1

|||

Thanks. do you know how i would implement paging with this?

|||

Thanks. do you know how i would implement paging with this?

It should be very easy to impliment this sp to your application using visual studio. For example ,you can use sqlcommand. Your stored procedure takes two parameters @.startRowIndex and@.maximumRows . First build a sqlcommand and set commond type to stored procedure and command text to your procedure name. Add two parameters(corresponding to @.startRowIndex and@.maximumRows) to your sqlcommand.parameters and call ExecuteReader(). This way you will be able to get the table returned by your stored procedure.

I suggest you reading this:http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx

Hope my suggestion helps

Friday, March 9, 2012

I am having trouble connecting to the database

Dear Sir -

I am new to thsi and I have installed the SQL server 2005 Dev (not express). I am useing Visual Web Express - When I create an application and attempt to launch it - the web config tell me that I am unable to connect to the Database - in the properties page (sidebar) the database status says closed - an I cannot seem to connect if though I go into the connections and test it says connected!

What is happening?

I need this to work? Can anyone assist?

Hi Harris,

Did you check your config file once, may be you passing wrong connection string.

Thanks & Regards,

Kiran.Y

I am having trouble connecting to the database

Dear Sir -

I am new to thsi and I have installed the SQL server 2005 Dev (not express). I am useing Visual Web Express - When I create an application and attempt to launch it - the web config tell me that I am unable to connect to the Database - in the properties page (sidebar) the database status says closed - an I cannot seem to connect if though I go into the connections and test it says connected!

What is happening?

I need this to work? Can anyone assist?

Hi Harris,

Did you check your config file once, may be you passing wrong connection string.

Thanks & Regards,

Kiran.Y

Friday, February 24, 2012

Hyperlink Action

When I run my report in Visual Studio and click on the hyperlink, it works
fine.
However, when I run my report via the browser after deploying it, the
hyperlinks doesn't work.
Please help!I am receiving an Internet Explorer error when clicking on the hyperlink. I
did not have this problem previously nor did I changed the report.rdl file
etc.
Line: 129
Char: 5
Error: 'event' is null or not an object
Code: 0
URL: http:://reportserv/reports/paages/report.asppx?ItemPath=%
2fDesigners_Council%2fReports%2fForm_Letter
"Terry" wrote:
> When I run my report in Visual Studio and click on the hyperlink, it works
> fine.
> However, when I run my report via the browser after deploying it, the
> hyperlinks doesn't work.
> Please help!

hyperlink

Hi everyone, I am trying to hyperlink a file to the report. We are running visual and in one of the fields, we have a pdf file linked to it. When I tried making a report that pulls that information so we can click on it and be linked directly to the file, but all it gives me is the path to the file. Is it possible to link it that way? I notice under properties, there are option for linking but its just for a report, bookmark, and URL. but none for direct files. Please help.

Thanks

abz

I am not so sure that this is a supported feature in Business Intelligence Studio. It is quite simple to do using Visual Studio, though.

You would need to write code to programmatically open the file.

|||

I am running visual studio .net 2003. but where can I get info so I can write code to open it like you said?|||

You want to handle an event such as a linkbutton click event.

What language do you prefer? C#, VB? I'll dig up some sample code for you.

What type of file are you opening and what program do you want to open it with?

|||

Here is how to open a file in notepad.

C#

System.Diagnostics.Process.Start( "notepad.exe", "text.txt");

VB

Process.Start("notepad.exe", "c:\info.txt")

|||

Oh ok, well any language will be fine as long as it works, and the file is a PDF.

Thanks

abz

|||

OK, then it would probably be something like this:

Process.Start("Acrobat.exe", "c:\myFile.pdf")