Results 1 to 3 of 3

Thread: [RESOLVED] Strange SQL Problem

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] Strange SQL Problem

    Im connecting to a remote sqlserver database from my web application. however when i connect and retrieve the info from the database i try to assign it to a datagrid but when i run the web application the datagrid cannot be seem.

    i have not set visible = false

    and i can assign data from within the dataset to labels etc its just the table is not visible

    VB Code:
    1. Dim sqlstmt As String = "SELECT * FROM tblStatus"
    2.         Dim conn As New System.Data.SqlClient.SqlConnection("server=xxx.xxx.xxx.xxx;uid=xxxx;pwd=xxxx;database=xxxx")
    3.         Dim sqlcmd As New System.Data.SqlClient.SqlCommand(sqlstmt, conn)
    4.         Dim da As New System.Data.SqlClient.SqlDataAdapter(sqlcmd)
    5.         Dim ds As New DataSet
    6.         da.Fill(ds, "tblStatus")
    7.         'lblMissingData.Text = ds.Tables(0).Rows.Count
    8.         DataGrid1.DataSource() = ds
    9.         DataGrid1.Visible = True
    Last edited by Strider; Feb 3rd, 2005 at 09:05 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Strange SQL Problem

    DataGrid1.DataBind();

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: Strange SQL Problem

    As said above, but with this as well:
    DataGrid1.DataSource = ds.Tables("tblStatus")
    DataGrid1.DataBind()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width