Results 1 to 6 of 6

Thread: how to run sql through vb.net

  1. #1
    Junior Member
    Join Date
    May 2008
    Answers
    1

    Exclamation how to run sql through vb.net

    how to run a sql server 2005 sp through a windows application programm designed with vb.net 2005


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: how to run sql through vb.net

    What do you mena by to run a sql server 2005 sp through a windows application programm ?

    are you trying to execute DML /DDL statments or something else ?


  3. #3
    Junior Member
    Join Date
    Jun 2008
    Answers
    2

    Re: how to run sql through vb.net

    cmd = New SqlCommand("storedprocedure name", constr)

    cmd.CommandType = CommandType.StoredProcedure
    cmd.Parameters.Add("@variable name", SqlDbType.datatype, value).Value = selectedcontrol.SelectedItem.Value
    cmd.Parameters.Add("@variable name", SqlDbType.datatype, value).Value = ddCommodity.SelectedItem.Value
    constr.Open()
    varable name = cmd.ExecuteReader()


  4. #4
    Junior Member
    Join Date
    Aug 2008
    Answers
    1

    Re: how to run sql through vb.net

    Quote Originally Posted by gdtrigas View Post
    how to run a sql server 2005 sp through a windows application programm designed with vb.net 2005
    u can connect vb.net2005 with sql server 2005 very easily, simply write 3 lines in the code

    At the top of coding page write "Imports system.data.sqlclient", then there will be 1 line after that which will come automatically showing that webform after that write "Proteced sub as sqlconnection".............After that in the connection string every time write "Data Source=ASHISH\SQLEXPRESS;Initial Catalog=museum;Integrated Security=True"...................At the place of "ASHISH" write your computers name, at the place of "museum" write your database name from which u want to connect...

    Last edited by ashish rai; 08-11-2008 at 11:51 AM.

  5. #5
    Junior Member
    Join Date
    Oct 2008
    Answers
    1

    Re: how to run sql through vb.net

    connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
    cnn = New SqlConnection(connetionString)
    Try
    cnn.Open()
    MsgBox("Connection Open ! ")
    cnn.Close()
    Catch ex As Exception
    MsgBox("Can not open connection ! ")
    End Try


    for details information

    ADO.NET SQL Server Connection

    chan.


  6. #6
    Junior Member
    Join Date
    Nov 2008
    Answers
    3

    Re: how to run sql through vb.net

    If ur trying to connect any .net application with sqlserver ,then u need to create a connetion sting and sql commend like DML ans DDL


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact