Well, here is a simple example I'd like to see converted into an
ObjectDataSource version. It is a login that reads a row from the
database to log a member in.
<asp:SqlDataSource ID="SqlDataSource_Login" runat="server"
ConnectionString="<%$ ConnectionStrings:MyProjConnectionString
%>"
SelectCommand="SELECT * FROM [Members] WHERE ([Username] =
@Username)">
<SelectParameters>
<asp:ControlParameter ControlID="txtUserID"
Name="Username" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
Dim memtable As DataView =
CType(SqlDataSource_Login.Select(DataSourceSelectArguments.Empty),
DataView)
If memtable.Count <> 1 Then
lblOutput.Text = "LOGIN FAILURE"
Exit Sub
End If
Dim memrow As DataRowView = memtable(0)
Dim pwd As String = memrow("Password").ToString.Trim
If pwd <> txtPassword.Text.Trim Then
lblOutput.Text = "LOGIN FAILURE"
Else
Dim mem As Member
mem = New Member(emprow)
Session.Add("mem", mem)
PageTransfer("Status.aspx") 'done
End If
On May 17, 2:18 am, Cerebrus <[email protected]> wrote:
> Many textbooks do that because of a simple reason - It provides the
> easiest and fastest way to demonstrate the use of a Datasource
> control. However, most textbooks will also show you how to use the
> ObjectDataSource control, albeit with a much more trivial example.
>
> Best practices is a very wide term. If you can narrow it down, you
> will surely be able to find guidance on the particular aspect of
> website development you are looking for.
>
> On May 17, 1:23 am, Davej <[email protected]> wrote:
>
> > I am disappointed that my textbook is presenting every example in
> > terms of SQLDataSource when I have been told here that
> > ObjectDataSource is a far better scheme to use. Is there an example of
> > VB ASP.NET code for a small website available somewhere online that
> > demonstrates best practices? Thanks.
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net