473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

SplibVB<>aspx

Hi
I split aspx for
1. aspx - www
2. vb
But i have problem because Statement is not valid in a namespace.
I don't know while this don't power becouse befor split wab all OK
Please Help Me
Thank You
Code in the VB
mports 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
-----------------------------------------------------
Code in the aspx
<%@ 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>
Nov 19 '05 #1
0 1326

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.