I am new to VB, and have attempted to load all the free versions of the SQL
available. Dispite many go's I still can not make any work.
I go through the motions of including a database into my programs
but I keep geting a long delay then "Unable to find server message".
I have Express 2013 and Win 7, all work fine in all else.
Can any one please help me???.

Recommended Answers

Please post the code you are using to connect to the database.

We can't help if we don't know. :)

Jump to Post

All 4 Replies

Please post the code you are using to connect to the database.

We can't help if we don't know. :)

Thanks for your interest:
I have not got to the code yet.
While in VB 2013Express IDE, I try to add a DB(not made yet).
I can not get the SQL server to create a DB.
Error = Unable to find server instance.This after a long wait.

SQL Sever Express uses

(local)\SQLExpress or .\SQLExpress

Please use this as the data source. Then you can either create or add an existing database file (mdb)

Here's the code that I use to make the connection to the database:

    Public sConnection As String = "Data Source=Don-PC;Initial Catalog=DataDesignSolutions;Integrated Security = True;User ID=DON-PC;Password=acd67011;"
    Public con As New SqlConnection
    Public cmd As New SqlCommand
    Public strQ As String
    Public sql As String
con = New SqlConnection(sConnection)
            cmd.CommandText = "SELECT LocationID, SellPrice1, SellPrice2, SellPrice3, SellPrice4, SellPrice5, ItemCost, FreightCost, UDCost1, UDCost2, AverageCost, Classification, VendorNumber, AltVenNumber, LotShadeSerialOut, TaxableItem, RequireDeposit, DepositPcntReq, CommissionPcnt FROM INVENTORY_LOCATIONS WHERE ProductID = " & GlobalResources.prodID & " AND Location = " & GlobalResources.loc1
            cmd.Connection = con
Dim rdr As SqlDataReader = cmd.ExecuteReader
            Do While rdr.Read()
                GlobalResources.locID = rdr(0)
                GlobalResources.prc1 = rdr(1)
                GlobalResources.prc2 = rdr(2)
                GlobalResources.prc3 = rdr(3)
                GlobalResources.prc4 = rdr(4)
                GlobalResources.prc5 = rdr(5)
                GlobalResources.itemCost = rdr(6)
                GlobalResources.frtCost = rdr(7)
                GlobalResources.udCost1 = rdr(8)
                GlobalResources.udCost2 = rdr(9)
                GlobalResources.avgCost = rdr(10)
                GlobalResources.clsfic = rdr(11)
                GlobalResources.vndrNo = rdr(12)
                GlobalResources.altvndrNo = rdr(13)
                GlobalResources.lotSerlShadeOut = rdr(14)
                GlobalResources.taxItem = rdr(15)
                GlobalResources.reqDep = rdr(16)
                GlobalResources.depPcnt = rdr(17)
                GlobalResources.commPcnt = rdr(18)

Good luck to you!

Be a part of the DaniWeb community

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