ASP.Net ile Veritabanına Kayıt Eklemek

WebMaster bölümünde yer alan bu konu hortLak tarafından paylaşıldı.

  1. hortLak

    hortLak c ε ή κ

    <%@ Page Language="VB" Debug="true" %>
    <%@ import Namespace="System.Data.OleDb" %>
    <script runat="server">

    Sub ekle(sender As Object, e As EventArgs)
    dim db_baglanti as OleDbConnection
    dim ad1 as string
    dim soyad1 as string



    ad1=ad.text
    soyad1=soyad.text



    db_baglanti = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; DATA Source=" & Server.MapPath("\Proje\TL-4A\kayit.mdb"))
    db_baglanti.Open()

    dim db_komut as OleDbCommand
    db_komut= New OleDbCommand( "Insert INTO deneme ( numara, gorus) Values( '"& ad1 &"','"& soyad1 &"')", db_baglanti )
    db_komut.ExecuteNonQuery
    msgbox("Görüşleriniz Eklendi.")
    ad1=""
    soyad1=""
    db_baglanti.Close()

    end sub



    </script>
    <html>
    <head>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) { //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <style type="text/css">
    <!--
    .style1 {
    font-family: Verdana;
    font-size: 14pt;
    }
    -->
    </style>
    </head>
    <body>
    <div id="Layer1" style="position:absolute; left:121px; top:15px; width:801px; height:31px; z-index:1">
    <table width="804" border="1">
    <tr>
    <td><span class="style1">1001 Fikret Öztürk </span></td>
    </tr>
    </table>
    </div>
    <div id="Layer2" style="position:absolute; left:122px; top:57px; width:802px; height:362px; z-index:2">
    <table width="800" height="361" border="1" id="table1">
    <tr>
    <td> </td>
    </tr>
    </table>
    </div>
    <p><img src="1001.jpg" width="96" height="112" border="2"></p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <form runat="server">
    Numaranız:
    <asp:TextBox id="ad" runat="server"></asp:TextBox>
    <br />
    <br />
    Gorusunuz:
    <asp:TextBox id="soyad" runat="server" TextMode="MultiLine" Height="25"></asp:TextBox>
    <br />
    <asp:Button id="Button1" onclick="ekle" runat="server" Text="Bilgileri Ekle"></asp:Button>
    <br />
    </form>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    </body>
    </html>