dataadepter.fill lost session state?

M

mtcc

i try simple web page, for first time i add session "aa" var, and i add
button, and i check if
session keep aa value in postback.

when i add call to Dataadapter.fill method, i lost my session on postback,
and i get isNewSession=true!!

help please!

===============================
heare my code:

the web.config:
================
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="true"
timeout="520"
/>

========================
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="asp1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">&nbsp;
<asp:Button id="btnCalc" style="Z-INDEX: 104; LEFT: 320px; POSITION:
absolute; TOP: 104px" runat="server"
Width="225px" Height="79px" Text="çùá"></asp:Button></form>
</body>
</HTML>



=======================================

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.cnn = New System.Data.OleDb.OleDbConnection
'
'cnn
'
Me.cnn.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=0;Data
Source=""C:\Inetpub\wwwroot\asp1\bin\CHANGE.mdb"";Mode=Share De" & _
"ny None;Jet OLEDB:Engine
Type=4;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:Sys" & _
"tem database=;Jet OLEDB:SFP=False;persist security
info=False;Extended Propertie" & _
"s=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt
Database=Fal" & _
"se;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy
Locale on Compact" & _
"=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"

End Sub
Protected WithEvents cnn As System.Data.OleDb.OleDbConnection
Protected WithEvents btnCalc As System.Web.UI.WebControls.Button

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not (IsPostBack) Then
Dim adp As New OleDb.OleDbDataAdapter("select * from tblChange",
cnn)
Dim tbl As New DataTable
adp.Fill(tbl) <==

Session.Add("aa", 99) <===

End If

End Sub

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalc.Click
End Sub


End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top