(“server=bnewsome;database=pubs;user id=sa;password=!p@ssw0rd!;”)

Status
Not open for further replies.

deepakgates

Broken In
Im reading this wrox beginning visual basic 2005

and in an example it says
(“server=bnewsome;database=pubs;user id=sa;password=!p@ssw0rd!;”)

firstly what is "bnewsome" what i have to use in case of local host
i got sample database pubs
but i don't know the user id and password of my sql server i just installed visual studios 2008.
-------------------------------------------
one more thing i cant establish connection with my sql server
its the ever popular error " Named Pipes Provider: Could not open a connection to SQL Server [2]"

i just overcame tcp/ip error

----------------------------------------
also after sc query mssqlserver

there is an error enumqueryservicesstatus openservice failed 1060
-----------------------------------------


im fed up
anyone???

---------- Post added at 01:54 PM ---------- Previous post was at 12:10 PM ----------

well i did some research and did some code

imports system.data
imports system.data.sqlclient
public class form1
dim objconnection as new sqlconnection("server=localhost;uid=sa;pwd=;database=pubs")
dim objdataadapter as new sqldataadapter()
dim objdataset as new dataset()
private sub form1_load(byval sender as object, byval e as system.eventargs) handles me.load
' set the selectcommand properties...
Objdataadapter.selectcommand = new sqlcommand()
objdataadapter.selectcommand.connection = objconnection
objdataadapter.selectcommand.commandtext = "select au_lname, au_fname, title, price " & "from authors " & "join titleauthor on authors.au_id = titleauthor.au_id " & "join titles on titleauthor.title_id = titles.title_id " & _
"order by au_lname, au_fname"
objdataadapter.selectcommand.commandtype = commandtype.text
' open the database connection...
Objconnection.open()
' fill the dataset object with data...
Objdataadapter.fill(objdataset, "authors")
' close the database connection...
Objconnection.close()
' set the datagridview properties to bind it to our data...
Grdauthortitles.autogeneratecolumns = true
grdauthortitles.datasource = objdataset
grdauthortitles.datamember = "authors"
' clean up
objdataadapter = nothing
objconnection = nothing
end sub
end class


and the result

an error has occurred while establishing a connection to the server. When connecting 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 connection to sql server)

see the attachment
 
Last edited:

Rollercoaster

-The BlacKCoaT Operative-
how are you trying to connect to the SQL instance?

sometimes '.' or '(local)' doesnt work. try to use ur computer's name (system properties > computer name tab) in addition to the instance name for e.g. normal SQL instance is named 'SQLEXPRESS' so use 'MYCOMPUTERNAME\SQLEXPRESS' and use Windows Authentication to connect

bnewsome appears to be the server name so you have to have access to that server to connect to the sql instance on that server

if u still have problems post on forums.asp.net in the sql section
 

krishnandu.sarkar

Simply a DIGITian
Staff member
You don't need to know anything. Just inset a SQLDataSource object from the toolbar. Select the required database and the connection string will show up. Just copy paste that :)
 
OP
deepakgates

deepakgates

Broken In
hey there is no sql data source in toolbox

im using vs2008 and sql server 2005 express

---------- Post added at 05:35 AM ---------- Previous post was at 04:21 AM ----------

okay i did every thing
this is my connection string
("server=home-d4cb6302e5\SQLEXPRESS;database=pubs;user id=sa;password=pass123;")


now the error is
Cannot open database "pubs" requested by the login. The login failed. Login failed for user 'sa'.

even on
("server=home-d4cb6302e5\SQLEXPRESS;database=pubs;Integrated Security=True;")

error comes
Cannot open database "pubs" requested by the login. The login failed. Login failed for user 'HOME-D4CB6302E5\Deepak'.
 

krishnandu.sarkar

Simply a DIGITian
Staff member
Well...Even I use VS2008. There must be something wrong. Ok there are connection tools in Toolbox. If you can't find it leave it. Just select the database and copy the connection string from the properties.
 
Status
Not open for further replies.
Top Bottom