Strict Standards: Redefining already defined constructor for class wpdb in /blog/wp-includes/wp-db.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /blog/wp-includes/cache.php on line 35

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /blog/wp-includes/cache.php on line 400

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /blog/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /blog/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /blog/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /blog/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /blog/wp-includes/classes.php on line 553

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /blog/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /blog/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /blog/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /blog/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /blog/wp-includes/classes.php on line 674

Deprecated: Assigning the return value of new by reference is deprecated in /blog/wp-includes/query.php on line 15

Deprecated: Assigning the return value of new by reference is deprecated in /blog/wp-includes/theme.php on line 505

Strict Standards: Non-static method Advanced_Permalinks::get() should not be called statically in /blog/wp-content/plugins/advanced-permalinks/advanced-permalinks.php on line 825

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /blog/wp-includes/plugin.php on line 123

Warning: call_user_func_array() expects parameter 2 to be array, null given in /blog/wp-includes/plugin.php on line 123

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 942
Bazy danych » egrafik.pl
BAZA WIEDZY
KURSY
Bazy danych w PHP
Kurs AdvancedAJAX
Kurs ASP
Kurs ASP.NET
Kurs C++
Kurs CSS
Kurs HTML
Kurs HTML drugi
Kurs JavaScript
Kurs MySQL
Kurs PHP
Kurs RSS
Kurs XHTML
Obiekty DOM
MANUALE
CSS1 - W3C
DOM - w budowie
PHP 2005
PHP 2006
Wyrażenia regularne
SHOUTBOX
STAT
Online: 16 | UU: 610

Strict Standards: Resource ID#251 used as offset, casting to integer (251) in /forum2/db/mysql4.php on line 223

Strict Standards: Resource ID#251 used as offset, casting to integer (251) in /forum2/db/mysql4.php on line 224
Bazy danych
6 grudzień 2007

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Deprecated: Function eregi() is deprecated in /blog/wp-content/plugins/tpbc.php on line 96

Na stronach ASP.NET dostęp do bazy może odbywać się za pomocą objektów ADO+. W celu pobrania wartości z bazy danych poprzez ADO+ należy użyć procedur innych niż w przypadku korzystania z ADO.
Kontrolka Datagrid dostarczona z ASP.NET służy do prezentacji danych pobranych z bazy danych. Najpierw jednak należy zadeklarować język skryptowy użyty w pliku ASP.NET, oto ptrzykład:

Kod: asp

<%@ Page Language="VB"%>

Językiem użytym w pliku jest "VB", czyli Visual Basic.

Następnym krokiem jest zaimportowanie bibliotek umożliwiających utworzenie obiektu Datasetcommand orez innych obiektów ADO, tj. Connection, Dataset. Poniżej przedstawione są instrukcje wykonujące w/w czynności:

Kod: asp

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>

Teraz należy umieścić pozostałą część skryptu, umożliwiającego dostęp do bazy danych. Poniższy przykład zawiera nawiązanie połączenia i pobranie danych dla kontrolki umieszczonej po stronie serwera.

Kod: asp

<script language="VB" runat="server">
Sub subbtn_OnClick(Sender As Object, E As EventArgs)
Dim objConn As ADOConnection
Dim objDtsCmd As ADODataSetCommand
Dim objDts As DataSet
Dim SQLQuery As String
Dim strConn As String
SQLQuery = "SELECT * FROM nazwa_tabeli"
strConn = "DBQ=" & Server.MapPath("database.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
objConn = New ADOConnection(strConn)
objDtsCmd = New ADODataSetCommand(SQLQuery, objConn)
objDts = New DataSet()
objDtsCmd.FillDataSet(objDts, "nazwa_tabeli")
dtgrid.DataSource = objDts.Tables("nazwa_tabeli").DefaultView
dtgrid.DataBind()
End Sub
</script>

Następnie należy umieścić poniższy kod HTML w pliku ASP.NET

Kod: asp

<HTML>
<BODY>
<FORM ACTION="db.aspx" METHOD="POST" RUNAT="server">
<asp:Button TYPE="submit" ID="subbtn" TEXT="Run Query" OnClick="subbtn_OnClick" RUNAT="server" />
</FORM>
<asp:DataGrid ID="dtgrid" HeaderStyle-Font-Bold="True" ToolTip="DataGrid dostarczony z ASP.NET" RUNAT="server" maintainviewstate="false" />
</BODY>
</HTML>

Powyższy kod wypełnia kontrolką Datagrid wartościami pobranymi z bazy danych o nazwie ‘database.mdb’.


Autor: Krzysztof Stelmach
Strona pochodzi z http://www.stelmach.info/

WordPress database error: [Incorrect file format 'wp_comments']
SELECT * FROM wp_comments WHERE comment_post_ID = '643' AND comment_approved = '1' ORDER BY comment_date desc

Dodaj komentarz









 
 
| | | |
Copyright © 2006-2013 egrafik.pl | Kontakt | Reklama | Projekty domów
jocker