hi guys... i am working on the project in vb.net in visual studio... my computer's name is homesys(Computer name as shown in MY Computer Properties)....
when i try to make crystal report using sql server 2008 database... which i made it in visual studio itself, i am unable to get the connection
i tried homesys,localhost,localhost:5050,localhost:8080 for the server names to establish the connection but i always got the error saying login failed.......
could any one pls hlp me. it's urgent i need to complet my project
how to know the server name ..

thnx in advance

Dani AI

Generated

A concise, practical follow‑up for that builds on and : the problem usually comes down to (1) the exact SQL Server instance that’s installed, (2) whether SQL Server is listening on a network protocol/crystal can reach, and (3) the credentials the report actually uses (including every subreport). The checklist below shows how to discover the instance, quickly test reachability, and make Crystal Reports use the right logon at runtime.

Find and test the instance

  • Open Windows Services (services.msc) or SQL Server Configuration Manager and look for entries that start with "SQL Server (" — the name inside the parentheses is the instance name (a default instance appears differently). A quick, no‑code connectivity test is to create a blank text file, rename it to test.udl, double‑click it and use the Data Link Properties dialog to try a connection with the authentication you plan to use. If you have a named instance, ensure the SQL Server Browser service is running, TCP/IP is enabled for that instance, and firewall rules allow the instance’s port.

Crystal Reports: apply credentials and handle subreports
Use the report designer’s Data Source/Verify tools or set credentials at runtime so every table and subreport uses the same ConnectionInfo. The VB.NET pattern below shows applying ConnectionInfo to all tables and subreports before assigning the report to the viewer.

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rpt.Load("C:\Path\MyReport.rpt")

Dim ci As New CrystalDecisions.Shared.ConnectionInfo()
ci.ServerName = "HOMESYS\YourInstance"
ci.DatabaseName = "YourDatabase"
ci.UserID = "sqluser"
ci.Password = "sqlpassword"
ci.IntegratedSecurity = False

For Each t As CrystalDecisions.CrystalReports.Engine.Table In rpt.Database.Tables
  Dim li = t.LogOnInfo
  li.ConnectionInfo = ci
  t.ApplyLogOnInfo(li)
Next

' update subreports similarly (open each SubreportObject and repeat)
CrystalReportViewer1.ReportSource = rpt

Note: if you use Windows authentication, run the process under an account that has database access or use Integrated Security. Also remember to update every subreport—failing to do so is a common cause of “login failed.”

Recommended Answers

All 7 Replies

The error message "login failed" suggests the a connection is created but that either
a) you not using windows authentication but the connection string is set for a proper login,
b) you're not using windows authentication and the username and/or password is wrong.
c) you are using windows authentication but the connection string is wrong (Connectionstrings) or

You should look into those scenarios.

pls help how to get the server name, username and password for sqlserver 2005. My computer name is homesys, i have three users administrator,Computer and User... pls help me....

The simplest way, I guess, would be to use Server Explorer in Visual Studio.
There you will see, if any, the database server and it's name.
You will find it in the View menu.

hi

server name will be displayed in the server explorer, add \sqlexpress to that to make
your connection
ex- if the server name is kartik-22e9a587 then use the sql server name as kartik-22e9a587\sqlexpress then choose the approproate steps

tanx bro

any tym bro

Thanks @ kaar3k

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.