Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books to buy from the datagrid.
User can select books using checkboxes in the datagrid.
The selected books are stored in a session variable name session("temp") which is a dataset type.After storing dataset in session (in bold letters),user will redirected to next page "webform6.aspx" . Here is the code.... - sub button2_click(sender as object,e as eventargs)
-
'con.close()
-
dim da as sqldataadapter,ds as dataset
-
dim con as sqlconnection
-
dim griditem as datagriditem
-
dim kk as boolean
-
dim row as integer
-
con=new sqlconnection("server=WADHWA;user id=sa;pwd=;initial catalog=OnlineShoppingDatabase")
-
con.open()
-
da=new SqlDataAdapter()
-
da.selectcommand=new SqlCommand()
-
da.selectcommand.connection=con
-
da.selectcommand.commandtext="insert temp_info values(@BookId,@CatId,@Title,@Author,@Publisher,@Price,@Quantity)"
-
da.selectcommand.parameters.add(new sqlparameter("@BookId",SqlDbType.Int,0,"BookId"))
-
da.selectcommand.parameters.add(new sqlparameter("@CatId",SqlDbType.Int,0,"CatId"))
-
da.selectcommand.parameters.add(new sqlparameter("@Title",SqlDbType.varchar,10,"Title"))
-
da.selectcommand.parameters.add(new sqlparameter("@Author",SqlDbType.varchar,10,"Author"))
-
da.selectcommand.parameters.add(new sqlparameter("@Publisher",SqlDbType.varchar,10,"Publisher"))
-
da.selectcommand.parameters.add(new sqlparameter("@Price",SqlDbType.float,0,"Price"))
-
da.selectcommand.parameters.add(new sqlparameter("@Quantity",SqlDbType.Int,0,"Quantity"))
-
-
-
for each griditem in datagrid1.items
-
'chk=griditem.cells(0).findcontrol("checkbox")
-
'kk=directcast(griditem.Cells(1).Controls(0), CheckBox).checked
-
da.selectcommand.parameters("@BookId").value=integer.parse(griditem.cells(8).text)
-
da.selectcommand.parameters("@CatId").value=integer.parse(griditem.cells(9).text)
-
da.selectcommand.parameters("@Title").value=griditem.cells(2).text
-
da.selectcommand.parameters("@Author").value=griditem.cells(3).text
-
da.selectcommand.parameters("@Publisher").value=griditem.cells(4).text
-
da.selectcommand.parameters("@Price").value=decimal.parse(griditem.cells(5).text.Replace(" ", ""), Globalization.NumberStyles.AllowThousands or Globalization.NumberStyles.AllowCurrencySymbol or Globalization.NumberStyles.AllowDecimalPoint)
-
da.selectcommand.parameters("@Quantity").value=integer.parse(griditem.cells(6).text)
-
kk=directcast(griditem.cells(0).findcontrol("checkbox1"),checkbox).checked
-
if kk then
-
'response.write("checked")
-
row =da.selectcommand.executenonquery()
-
end if
-
row=0
-
next
-
ds=new DataSet
-
da.fill(ds,"temp_info")
-
session("temp")=ds
-
'ds = nothing
-
'da=nothing
-
con.close()
-
response.redirect("webform6.aspx")
-
end sub
Then, I retrieve this dataset on the page load event of "webform6.aspx" .Here is the code..... - Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
'Put user code to initialize the page here
-
'If Not Page.IsPostBack Then
-
If Session("temp") Is Nothing Then
-
ds = New DataSet
-
da = New SqlDataAdapter
-
con = New SqlConnection("server=WADHWA;user id=sa;pwd=;initial catalog=onlineshoppingdatabase")
-
con.Open()
-
da.SelectCommand = New SqlCommand("select * from temp_info", con)
-
da.Fill(ds, "temp_info")
-
'DataGrid1.DataSource = ds
-
'DataGrid1.DataSource = ds.Tables("temp_info")
-
DataGrid1.DataBind()
-
End If
-
If Not Page.IsPostBack Then
-
'DataGrid1.EnableViewState = False
-
ds = New DataSet
-
ds = CType(Session("temp"), DataSet)
-
DataGrid1.DataSource = ds
-
DataGrid1.DataBind()
-
End If
-
End Sub
But, I got an error :
Exception Details: System.Web.Http Exception: The IListSource does not contain any data sources.
But, I got an error :
Exception Details: System.Web.Http Exception: The IListSource does not contain any data sources.
Help me to remove this error and give me some good knowledge on this issue
1 2415
Welcome to the site. Where do you use IListSource?
Please use code tags (# icon) as it makes your code easier to read. Thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Shawn |
last post by:
In my application, I have users that are registered in
SQL Server. When they login, a flag is set to indicate
they are logged in (dll). The procedure to set that flag
uses information stored in the session variable at the
time of login using HTTPContext
(httpcontext.current.session.item("bitLoggedIn").
When the user logs out, I call the Session.Abandon() to
change the flag to false in the Session_End. When I try
to retrieve data...
|
by: Vik |
last post by:
A dataset is saved in session state. Then the dataset is filled out with the
new records using a dataadapter. It appears then that the dataset saved in
session state contains the new records even without saving the updated
dataset.
Why does this happen? How can I preserve the dataset saved in session state
from automatical updating?
Thank you.
|
by: enrique |
last post by:
Hello,
I simpy want to place a record ID into a session variable.
I know how to create session variables, I'm just can't figure out the syntax
for the record item when I'm working with a dataset. I'm using vb.
session(sessionName) = recordID 'from dataset or dataview
Thanks,
Enrique
|
by: xaime |
last post by:
Hi all,
I have the code below. This is doing what I want, but always has the
following exception:
Update unable to find TableMapping or Datatable 'mytable'
The code I'm using is:
Try
|
by: Frank |
last post by:
Can I do this?
I add a session var in C# and ultimatly want to pass it into a vbscript
client side activeX control. This is what I have so far but get " Object
Required:'name2' " error.
Can anyone suggest a btter way of passing a session var into a vbscript
function?
<%@ Page language="c#" debug="true" ContentType="text/html"
| |
by: tshad |
last post by:
I had asked about this before, but have been unable to solve the problem.
Could this be a problem with Web Services?
I have 4 web services that I reference in this object. There is only one
class.
I have an object I am unable to put in my session. I have others that have
no problem. The difference is the the one I am having problems with was
created in VS 2003. The others were created using DW and compiling using the
commandline...
|
by: Abi |
last post by:
We able to generate this error in our test environment and were able to
research this enough to understand that the issue is NOT with an abject that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream data
to an ASP Session State database (SQL Server 2000) .
Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database...
|
by: whidbey |
last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books to buy from the datagrid.
User can select books using checkboxes in the datagrid.
The selected books are stored in a session variable name session("temp") which is a dataset type.After storing dataset in session (in bold letters),user will...
|
by: Elliot |
last post by:
When decrypt the xml, output "Unable to retrieve the decryption key."
Can anyone help me solve the problem?
I got the code from http://msdn.microsoft.com/en-us/library/ms229746.aspx
using System;
using System.Xml;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |