Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2004, 11:41 AM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default SplitAspx<>VB

Hi
I done split my code in aspx for aspx and *.vb*
But dont do it
I don't know while, because between split my code power
Please, help me

my cove in VB

Imports System
Imports System.Collections
Imports System.Configuration
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient



Public Sub Page_Load()
dim rek(100),serw(100)
dim conn
dim dbcomm,sql,dbread,dbconn1,dbcomm1
dim dbconn as New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("baza/Blok1.mdb"))


dim strImie as string = "adam"
dim a=New SortedList





dim mycountries=New ArrayList
dim x
dim b(10)




dbconn.Open()



sql="SELECT Login,IloscZlecen FROM Blokowanie where Blok=True"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()



if Not Page.IsPostBack then
BlokM()
end if






dbread.Close()

dbconn.Close()



end sub

function BlokM()

x=0
Do While dbread.Read()


    'Authors.Items.Add(New ListItem(dbread.Item("Login") + " " + Cstr(dbread.Item("IloscZlecen"))))
    'Authors.Items.Add(New ListItem(dbread.Item("Login") + " " + (Cstr(x))))
    a.add((x),(dbread.Item("Login") + " " + Cstr(dbread.Item("IloscZlecen"))))


       x=x+1
   loop
     rb.DataSource=a
   rb.DataValueField="Key"
   rb.DataTextField="Value"
   rb.DataBind()


End function

sub displayMessage(s as Object,e As EventArgs)

dbconn.Open()



sql="SELECT Login,IloscZlecen FROM Blokowanie where Blok=True"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()



'CreateDataSource() As ICollection

Dim dt As DataTable
 dt = new DataTable()
  Dim dr As DataRow

  dt.Columns.Add(new DataColumn("StringValue1", _
    System.Type.GetType("System.String")))

x=0

'Czytanie z bazy kolumn
Do While dbread.Read()
    rek(x)=dbread.item("IloscZlecen")
    serw(x)=dbread.item("Login")

 x=x+1
loop
    '
    '
    '
          'SelectedSerwisant.Text=(x)
          'Zlecenia.DataSource=("adam")
          'Zlecenia.DataBind()
          SelectedSerwisant.Text="Serwisant: " & (serw(rb.SelectedItem.Value)) & " Ilosæ zleceñ: " & (rek(rb.SelectedItem.Value))




'response.write(rek(rb.SelectedItem.Value))
'response.write(rek(rb.SelectedItem.Value)+1)

dbread.Close()

dbconn.Close()


End Sub

Public Sub button1(Sender As Object, e As EventArgs)

'text.InnerHtml="You clicked the button"
'response.write("Adam")
'response.write(rek(rb.SelectedItem.Value))
Dim UpDate1
UpDate1="UPDATE Blokowanie SET IloscZlecen=IloscZlecen+1 WHERE Login='Aszo'"


ExecuteStatement(UpDate1)
End Sub

function ExecuteStatement(UpDate1)

dim objCmd as new OleDbCommand(UpDate1,dbconn)
try
            objCmd.Connection.Open()

            'objCmd.ExecuteNonQuery()



objCmd.ExecuteNonQuery()

dbconn.Close()
catch ex as Exception
            response.write("Wyst¹pi³ b³¹d aktualizacji bazy danych."+ex.message)
    end try

        objCmd.Connection.Close()

end function
---------------------------------
and www
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
<%@ Page Language="vb" AutoEventWireup="false" Src="vb1.vb"
Inherits="ASPAuthors.aspnetbyexample.ch10.Chapter1 0Login" %>


<html>
<body>
<form runat="server">
     <asp:label id="Status" runat="server" />
     <Table>
     <tr>
          <td>
 <asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" onSelectedIndexChanged="displayMessage"/>
</td>
</tr>
</Table>
<p><asp:label id="SelectedSerwisant" runat="server" /></p>






<p id="text" runat="server" />
 </form>
 </body>
 </html>


 
Old December 13th, 2004, 12:26 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know
I will have to declar
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
 Imports System.Data.OleDb

But I don't know how declar
RabioButton
and
Label
May be
 Protected WithEvents SelectedSerwisant As System.Web.UI.WebControls.RadioButton
Please, help me


 
Old December 13th, 2004, 12:33 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Protected WithEvents SelectedSerwisant As System.Web.UI.WebControls.RadioButton
Protected WithEvents rb As System.Web.UI.WebControls.Label
Don't power

'DataSource' is not a member of 'System.Web.UI.WebControls.Label'
While?
Plaese correct me


 
Old December 13th, 2004, 12:58 PM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I correct my code
But www don't show me VB
Help me please

Imports System
Imports System.Collections
Imports System.Configuration
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
 Imports System.Data.OleDb

Public Class Label
    Inherits System.Web.UI.Page

Protected WithEvents rb As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents SelectedSerwisant As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection

    End Sub
Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
#End Region


dim rek(100),serw(100)
dim conn
dim dbcomm,sql,dbread,dbconn1,dbcomm1
dim dbconn as New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("baza/Blok1.mdb"))


dim strImie as string = "adam"
dim a=New SortedList





dim mycountries=New ArrayList
dim x
dim b(10)

Public Sub Page_Load()


dbconn.Open()



sql="SELECT Login,IloscZlecen FROM Blokowanie where Blok=True"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()



if Not Page.IsPostBack then
BlokM()
end if






dbread.Close()

dbconn.Close()



end sub

function BlokM()

x=0
Do While dbread.Read()


    'Authors.Items.Add(New ListItem(dbread.Item("Login") + " " + Cstr(dbread.Item("IloscZlecen"))))
    'Authors.Items.Add(New ListItem(dbread.Item("Login") + " " + (Cstr(x))))
    a.add((x),(dbread.Item("Login") + " " + Cstr(dbread.Item("IloscZlecen"))))


       x=x+1
   loop
     rb.DataSource=a
   rb.DataValueField="Key"
   rb.DataTextField="Value"
   rb.DataBind()


End function

sub displayMessage(s as Object,e As EventArgs)

dbconn.Open()



sql="SELECT Login,IloscZlecen FROM Blokowanie where Blok=True"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()



'CreateDataSource() As ICollection

Dim dt As DataTable
 dt = new DataTable()
  Dim dr As DataRow

  dt.Columns.Add(new DataColumn("StringValue1", _
    System.Type.GetType("System.String")))

x=0

'Czytanie z bazy kolumn
Do While dbread.Read()
    rek(x)=dbread.item("IloscZlecen")
    serw(x)=dbread.item("Login")

 x=x+1
loop
    '
    '
    '
          'SelectedSerwisant.Text=(x)
          'Zlecenia.DataSource=("adam")
          'Zlecenia.DataBind()
          SelectedSerwisant.Text="Serwisant: " & (serw(rb.SelectedItem.Value)) & " Ilosæ zleceñ: " & (rek(rb.SelectedItem.Value))




'response.write(rek(rb.SelectedItem.Value))
'response.write(rek(rb.SelectedItem.Value)+1)

dbread.Close()

dbconn.Close()


End Sub

Public Sub button1(Sender As Object, e As EventArgs)

'text.InnerHtml="You clicked the button"
'response.write("Adam")
'response.write(rek(rb.SelectedItem.Value))
Dim UpDate1
UpDate1="UPDATE Blokowanie SET IloscZlecen=IloscZlecen+1 WHERE Login='Aszo'"


ExecuteStatement(UpDate1)
End Sub

function ExecuteStatement(UpDate1)

dim objCmd as new OleDbCommand(UpDate1,dbconn)
try
            objCmd.Connection.Open()

            'objCmd.ExecuteNonQuery()



objCmd.ExecuteNonQuery()

dbconn.Close()
catch ex as Exception
            response.write("Wyst¹pi³ b³¹d aktualizacji bazy danych."+ex.message)
    end try

        objCmd.Connection.Close()

end function
End Class
------------------
and
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
<%@ Page Language="vb" AutoEventWireup="false" Src="vb1.vb" %>


<html>
<body>
<form runat="server">
     <asp:label id="Status" runat="server" />
     <Table>
     <tr>
          <td>
 <asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" OnServerValidate="displayMessage"/>
</td>
</tr>
</Table>
<p><asp:label id="SelectedSerwisant" runat="server" /></p>






<p id="text" runat="server" />
 </form>
 </body>
 </html>








Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.