Julian Sanjaya
Julian Sanjaya

Reputation: 81

Is there any other way to store data from database, other than using dataset or datatable in ASP.NET?

Like the title suggest, I would like to ask, is there any other way to store data from database, other than using dataset or datatable in ASP.NET?

I'm currently using something like this:

 Public Function openDataTable(ByVal query As String) As DataTable
    Try
        If con.State <> ConnectionState.Closed Then con.Close()
        con.Open()
        dt = New DataTable
        adap = New SqlDataAdapter(query, con)
        adap.Fill(dt)
        con.Close()
    Catch ex As Exception
        MsgBox.Message)
    End Try

    Return dt
End Function

dt = conn.openDataTable("Select * From Employee")

It worked fine for me, but I would like to know, is there any other way to do it?

And if there is another way, would someone be so kind as to give me an example? Thanks.

Upvotes: 0

Views: 178

Answers (2)

Alex
Alex

Reputation: 6159

In .net framework 3.5 and above you can use linq with entity framework.

Start here:

  1. Getting Started with LINQ in C#
  2. Entity Framework

A very good Entity framework Tutorial: http://www.codeproject.com/Articles/363040/An-Introduction-to-Entity-Framework-for-Absolute-B

Introduction to LINQ: http://msdn.microsoft.com/en-us/library/bb397897.aspx

Getting Started with LINQ in Visual Basic

Upvotes: 2

cristi71000
cristi71000

Reputation: 1124

Yes. You could:

  1. Run SQL Statements directly
  2. Use Linq to SQL
  3. Use Entity Framework

Upvotes: 0

Related Questions