jpknarr

jpknarr

  • NA
  • 8
  • 0

Empty Data Grid in VB.net

Apr 13 2004 3:32 PM
Can someone please tell me why my data grid will not show up on internet explorer?? I have created the sql server 2000 connection. It is established. I have the sqlDataAdapter established. The data source is on the local server of which I have an established connection. I believe the problem might be in the "FILLING" of the sqlDataAdapter. I'm rambling ... so here's the code... (The database name is "Popouts". (SQL Server 2000)) Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.SqlCommand2 = New System.Data.SqlClient.SqlCommand Me.PopoutDataSet1 = New VB_SqlConnection.PopoutDataSet CType(Me.PopoutDataSet1, System.ComponentModel.ISupportInitialize).BeginInit() ' 'SqlConnection1 ' Me.SqlConnection1.ConnectionString = "server=DDKDESK2;user=justin;password=*******;database=popouts" ' 'SqlDataAdapter1 ' Me.SqlDataAdapter1.DeleteCommand = Me.SqlCommand1 Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1 Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1 Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "POPOUTSMAIN", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("Popout_num", "Popout_num"), New System.Data.Common.DataColumnMapping("Connection", "Connection"), New System.Data.Common.DataColumnMapping("Size", "Size"), New System.Data.Common.DataColumnMapping("Description", "Description"), New System.Data.Common.DataColumnMapping("user", "user"), New System.Data.Common.DataColumnMapping("Mod_date", "Mod_date"), New System.Data.Common.DataColumnMapping("AssignedType", "AssignedType"), New System.Data.Common.DataColumnMapping("Zone", "Zone")})}) Me.SqlDataAdapter1.UpdateCommand = Me.SqlCommand2 ' 'SqlInsertCommand1 ' Me.SqlInsertCommand1.CommandText = "INSERT INTO POPOUTS(Popout_num, Connection, Size, Description, [user], Mod_date, " & _ "AssignedType, Zone) VALUES (@Popout_num, @Connection, @Size, @Description, @Para" & _ "m1, @Mod_date, @AssignedType, @Zone); SELECT Popout_num, Connection, Size, Descr" & _ "iption, [user], Mod_date, AssignedType, Zone FROM POPOUTS" Me.SqlInsertCommand1.Connection = Me.SqlConnection1 Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Popout_num", System.Data.SqlDbType.NVarChar, 12, "Popout_num")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Connection", System.Data.SqlDbType.NVarChar, 50, "Connection")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Size", System.Data.SqlDbType.NVarChar, 6, "Size")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Description", System.Data.SqlDbType.NVarChar, 30, "Description")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Param1", System.Data.SqlDbType.NVarChar, 12, "user")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Mod_date", System.Data.SqlDbType.DateTime, 8, "Mod_date")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AssignedType", System.Data.SqlDbType.NVarChar, 2, "AssignedType")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Zone", System.Data.SqlDbType.VarChar, 10, "Zone")) ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT Popout_num, Connection, Size, Description, [user], Mod_date, AssignedType," & _ " Zone FROM POPOUTS" Me.SqlSelectCommand1.Connection = Me.SqlConnection1 ' 'PopoutDataSet1 ' Me.PopoutDataSet1.DataSetName = "PopoutDataSet" Me.PopoutDataSet1.Locale = New System.Globalization.CultureInfo("en-US") CType(Me.PopoutDataSet1, System.ComponentModel.ISupportInitialize).EndInit() End Sub Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents PopoutDataSet1 As VB_SqlConnection.PopoutDataSet Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid Protected WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents SqlCommand2 As System.Data.SqlClient.SqlCommand 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region 'Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.AbortTransaction 'Save the data. ' SqlDataAdapter1.Update(PopoutDataSet1) 'End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here 'Load the data SqlDataAdapter1.Fill(PopoutDataSet1) End Sub Private Sub DataGrid1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Load End Sub End Class PLEASE PLEASE PLEASE HELP!!! Thank you in advance!!! JP

Answers (4)