SQL queries

  • Hello people,

    I have made a couple of queries I want to use into a Visual studio project,

    now is my problem:

    all my queries have different statements.

    I believe the best is to show the results in a Datagridview

    Could someone help me how to view them there?

    I know how to do it... but I have got about 30 queries

    Here is my code so far:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    ComboBox1.DataSource = MyDB_DevDataSet.DataSetName.

    Dim connectionString As String = "Data Source=myDB\mySRV;Initial Catalog=Teknotrans_dev;Integrated Security=True"

    Dim sql As String = "SELECT * FROM CompanyMain"

    Dim connection As New SqlConnection(connectionString)

    Dim dataadapter As New SqlDataAdapter(sql, connection)

    Dim ds As New DataSet()

    connection.Open()

    dataadapter.Fill(ds, "CompanyMain_Table")

    connection.Close()

    DataGridView1.DataSource = ds

    DataGridView1.DataMember = "CompanyMain_Table"

    End Sub

    Could someone help me?

    I believe I can make it easier help me thank you in advance

  • There's isn't enough information on what you want to accomplish here. 30 of what query? What is the end result you're looking to get?

    ---------------------------------------------------------------
    Mike Hahn - MCSomething someday:-)
    Right way to ask for help!!
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    I post so I can see my avatar :hehe:
    I want a personal webpage 😎
    I want to win the lotto 😀
    I want a gf like Tiffa :w00t: Oh wait I'm married!:-D

  • Hi again,

    sorry for a late answer,

    I want to present each query in each column in a datagridview

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply