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
and the result
see the attachment
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: