|
 |
aspx thread: web application and forms
Message #1 by Abdul Sami <abdul_sami_20@y...> on Sun, 21 Apr 2002 21:37:05 -0700 (PDT)
|
|
Hi all,
I am new to .net environment.
When I try to develop a simple web application and web form brwoser shows
nothing except any labels used in the web form(.aspx).
For example if I use data grid, text boxes, list boxes etc.
The steps which I follow are:
1:creates connection.
2:oledb adapter (refrenced to connection).
3:generate dataset(by oledb adapter).
4:creates data view.
5:creates datagrid and other objects like list items (refrenced to data
view/data set).
6:build and browse.
and finally browser shows nothing except labels if any.
If someone helps me I will be able to develop a simple database page.
=====
Abdul Sami
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
Message #2 by "Michael" <mlang@m...> on Mon, 22 Apr 2002 14:42:01 +1000
|
|
Post the code.
1. Check and make sure that you're filling the dataset from the data
adapter:-
oleDataAdapter1.Fill(DataSet1);
2. Make sure you call Databind on the control:-
datagrid1.DataBind();
-----Original Message-----
From: Abdul Sami [mailto:abdul_sami_20@y...]
Sent: Monday, 22 April 2002 2:37 PM
To: ASP+
Subject: [aspx] web application and forms
Hi all,
I am new to .net environment.
When I try to develop a simple web application and web form brwoser shows
nothing except any labels used in the web form(.aspx).
For example if I use data grid, text boxes, list boxes etc.
The steps which I follow are:
1:creates connection.
2:oledb adapter (refrenced to connection).
3:generate dataset(by oledb adapter).
4:creates data view.
5:creates datagrid and other objects like list items (refrenced to data
view/data set).
6:build and browse.
and finally browser shows nothing except labels if any.
If someone helps me I will be able to develop a simple database page.
=====
Abdul Sami
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
Message #3 by Abdul Sami <abdul_sami_20@y...> on Mon, 22 Apr 2002 03:04:39 -0700 (PDT)
|
|
I am not writing the code myself , it is self generated code.
I have addedd two lines you asked me to do.
-----------code starts here---------
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents OleDbDataAdapter1 As
System.Data.OleDb.OleDbDataAdapter
Protected WithEvents OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents OleDbInsertCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents OleDbUpdateCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents OleDbDeleteCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents DataSet11 As WebApplication5.DataSet1
Protected WithEvents OleDbCommand1 As System.Data.OleDb.OleDbCommand
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents OleDbConnection2 As
System.Data.OleDb.OleDbConnection
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter()
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbInsertCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbUpdateCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbDeleteCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbConnection2 = New System.Data.OleDb.OleDbConnection()
Me.DataSet11 = New WebApplication5.DataSet1()
Me.OleDbCommand1 = New System.Data.OleDb.OleDbCommand()
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'OleDbDataAdapter1
'
Me.OleDbDataAdapter1.DeleteCommand = Me.OleDbDeleteCommand1
Me.OleDbDataAdapter1.InsertCommand = Me.OleDbInsertCommand1
Me.OleDbDataAdapter1.SelectCommand = Me.OleDbSelectCommand1
Me.OleDbDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "Employees", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), New
System.Data.Common.DataColumnMapping("DepartmentName", "DepartmentName"),
New System.Data.Common.DataColumnMapping("SocialSecurityNumber",
"SocialSecurityNumber")})})
Me.OleDbDataAdapter1.UpdateCommand = Me.OleDbUpdateCommand1
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT DepartmentName,
EmployeeID, SocialSecurityNumber FROM Employees"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection2
'
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText = "INSERT INTO
Employees(DepartmentName, SocialSecurityNumber) VALUES (?, ?)"
Me.OleDbInsertCommand1.Connection = Me.OleDbConnection2
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("DepartmentName",
System.Data.OleDb.OleDbType.VarWChar, 50, "DepartmentName"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("SocialSecurityNumber",
System.Data.OleDb.OleDbType.VarWChar, 30, "SocialSecurityNumber"))
'
'OleDbUpdateCommand1
'
Me.OleDbUpdateCommand1.CommandText = "UPDATE Employees SET
DepartmentName = ?, SocialSecurityNumber = ? WHERE (Employee" & _
"ID = ?) AND (DepartmentName = ? OR ? IS NULL AND DepartmentName IS
NULL) AND (So" & _
"cialSecurityNumber = ? OR ? IS NULL AND SocialSecurityNumber IS
NULL)"
Me.OleDbUpdateCommand1.Connection = Me.OleDbConnection2
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("DepartmentName",
System.Data.OleDb.OleDbType.VarWChar, 50, "DepartmentName"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("SocialSecurityNumber",
System.Data.OleDb.OleDbType.VarWChar, 30, "SocialSecurityNumber"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_EmployeeID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(10, Byte), CType(0,
Byte), "EmployeeID", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DepartmentName",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "DepartmentName", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DepartmentName1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "DepartmentName", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_SocialSecurityNumber",
System.Data.OleDb.OleDbType.VarWChar, 30,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "SocialSecurityNumber", System.Data.DataRowVersion.Original,
Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_SocialSecurityNumber1",
System.Data.OleDb.OleDbType.VarWChar, 30,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "SocialSecurityNumber", System.Data.DataRowVersion.Original,
Nothing))
'
'OleDbDeleteCommand1
'
Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Employees WHERE
(EmployeeID = ?) AND (DepartmentName = ? OR ? IS NULL" & _
" AND DepartmentName IS NULL) AND (SocialSecurityNumber = ? OR ? IS
NULL AND Soci" & _
"alSecurityNumber IS NULL)"
Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection2
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_EmployeeID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(10, Byte), CType(0,
Byte), "EmployeeID", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DepartmentName",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "DepartmentName", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DepartmentName1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "DepartmentName", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_SocialSecurityNumber",
System.Data.OleDb.OleDbType.VarWChar, 30,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "SocialSecurityNumber", System.Data.DataRowVersion.Original,
Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_SocialSecurityNumber1",
System.Data.OleDb.OleDbType.VarWChar, 30,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "SocialSecurityNumber", System.Data.DataRowVersion.Original,
Nothing))
'
'OleDbConnection2
'
Me.OleDbConnection2.ConnectionString
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=E:\files\D" & _
"ocuments\OTHER THEN REACHWORLD\MS ACCESS\sami.mdb;Mode=Share Deny
None;Extended" & _
" Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry
Path="""";Jet OLEDB" & _
":Database Password="""";Jet OLEDB:Engine Type=4;Jet OLEDB:Database
Locking Mode=0;" & _
"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet OLE" & _
"DB:New Database Password="""";Jet OLEDB:Create System
Database=False;Jet OLEDB:Enc" & _
"rypt Database=False;Jet OLEDB:Don't Copy Locale on
Compact=False;Jet OLEDB:Compa" & _
"ct Without Replica Repair=False;Jet OLEDB:SFP=False"
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-GB")
Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd"
'
'OleDbCommand1
'
Me.OleDbCommand1.CommandText = "SELECT Employees.* FROM Employees"
Me.OleDbCommand1.Connection = Me.OleDbConnection2
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).EndInit()
End Sub
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 Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
DataGrid1.DataBind()
'Put user code to initialize the page here
End Sub
End Class
------------code ends here-------------
1: If you can tell me few steps to create a simple data generated form with
the help of grid.
2: Why should I use web forms if I can develop my applications with the
help of html forms with ASP.
REGARDS
( --- Michael <mlang@m...> wrote:
> Post the code.
>
> 1. Check and make sure that you're filling the dataset from the data
> adapter:-
>
> oleDataAdapter1.Fill(DataSet1);
>
> 2. Make sure you call Databind on the control:-
>
> datagrid1.DataBind();
>
> -----Original Message-----
> From: Abdul Sami [mailto:abdul_sami_20@y...]
> Sent: Monday, 22 April 2002 2:37 PM
> To: ASP+
> Subject: [aspx] web application and forms
>
>
> Hi all,
> I am new to .net environment.
> When I try to develop a simple web application and web form brwoser shows
> nothing except any labels used in the web form(.aspx).
> For example if I use data grid, text boxes, list boxes etc.
>
> The steps which I follow are:
> 1:creates connection.
> 2:oledb adapter (refrenced to connection).
> 3:generate dataset(by oledb adapter).
> 4:creates data view.
> 5:creates datagrid and other objects like list items (refrenced to data
> view/data set).
> 6:build and browse.
> and finally browser shows nothing except labels if any.
>
> If someone helps me I will be able to develop a simple database page.
>
>
> =====
> Abdul Sami
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
>
>
>
=====
Abdul Sami
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
|
|
 |