473,654 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Several questions

Hello,
I am using Microsoft Visual Studio 2003 .NET.

I have several question, please.

1) I have a connection to the database, which I create it at login,
by application("co nMain") (I have some problems by using
session("conMai n"), see question 2).

I don't know if it's a good thing to do, and not oppenning at each page the
connection (do I have to open and close a conneciton on each page, or not,
but programming carefully - if so then how shall I program ?) but I want to
know if :

How can I know that user has closed any of the pages, and I should close the
connection (what that happens, is that it's a oleDBConnection to *.mdb file,
and the *.mdb database stay openned, and when I open it in access
enviornment, it is at read only state).

Dialog-Box
---------------
2) I see that when I use dialog-box (by window.showModa lDialog), and the
dialog is an aspx page - it opens a new session,
can I stay at the same session as before ?
(I see that parameter Session("aaa") which is known in the calling form, is
unknown at the called dialog box) ?
3) What is the command to close the dialog box ?
4) Dialog box has status bar - can I hide it ? can I put my own text on the
status bar (at the bottom line) ?
5) How can I do refresh to the calling form that called the dialogbox just
after it called it ? (calling form is an aspx page).
6) How can I return the window.dialogAr guments, when the dialog-box is an
aspx page ?
------
7) How can I do updates to a query with oleDBCommand (the database is mdb).
I did :
dim cmd as oleDBCommand
.....

cmd.executeNone Query
....

What I get that it a message something like : ... not an update query ....
I run the query in the access enviornment, and it looks fine.
What may be wrong ?

8) I have a frameset, that linked to several aspx pages. one of the tabs is
780px width, and is linked to aspx page.
I need that the aspx page will be always 770px.
I cannot see the contour of the width and height when I open the page, and I
could find any automatic method that set always 770px in a new page.
Can I make a default width & height, or is there any simple method to limit
the size of any of the pages, and see immediatelly what happens on the
parent frameset page ?
9) I have an sln project, and for reason I don't know, now I cannot see the
sources of html pages, in a single one page.
What I see is only one of the sources of the pages (i.e main.htm) and I need
each time to double click on the relevant page on the sln explorer, in
oreder to see it.
What's wrong.

Thanks )


Nov 19 '05 #1
9 1304
> How can I know that user has closed any of the pages,

You can't know.
and I should close the connection (what that happens, is that it's a
oleDBConnectio n to *.mdb file, and the *.mdb database stay openned, and
when I open it in access enviornment, it is at read only state).
Any server side-code you write will be completed BEFORE the user ever gets
the page to look at in their browser. Therefore, you should always open
your connection early on in your page's processing (like Page_Load), do
whatever work you need to do and then close the connection when your work is
done. It has absolutely nothing to do with the page the user gets in their
browser. By the time they get the results of your code, your database
connection will have already been closed.

I see that you are still using the classic ASP applicatoin variables and
session variables. While both still work ASP.NET provides much more robust
ways to persist state. IMHO: you should stay away from these.
7) How can I do updates to a query with oleDBCommand (the database is
mdb).
I did :
dim cmd as oleDBCommand
....

cmd.executeNone Query
...

What I get that it a message something like : ... not an update query ....
I run the query in the access enviornment, and it looks fine.
What may be wrong ?
Your code above does not create an instance of anything because the keyword
"new" is not being used. Even if you had used it, you haven't configured
your command's CommandText (like a SQL statement or stored procedure name),
so your command has no idea what it is supposed to do when you call an
execute method. You also haven't configured the command to know what
connection it should use. Don't take this the wrong way, but this is pretty
fundamental ADO.NET stuff. You should really spend some time at
msdn.microsoft. com or ASP.NET or pick up a book on ASP.NET/ADO.NET.

This is more like what you need:

Dim conStr As String = "Provider=Micro soft.JET.OLEDB. 4.0;Data Source=" &
Server.MapPath( "relative path to your database here")
Dim con As New OleDb.OleDBConn ection(conStr)

Dim cmdStr As String = "SQL Statement Here"
Dim cmd As New OleDb.OleDbComm and(cmdStr, con)
Dim retVal As Integer

Try
con.Open
retVal = cmd.ExecuteNonQ uery
Catch ex As OleDBException
'Handle database exceptions here
Catch ex2 As Exception
'Handle other exceptions here
Finally
con.close
End Try
8) I have a frameset, that linked to several aspx pages. one of the tabs
is 780px width, and is linked to aspx page.
I need that the aspx page will be always 770px.
I cannot see the contour of the width and height when I open the page, and
I could find any automatic method that set always 770px in a new page.
Can I make a default width & height, or is there any simple method to
limit the size of any of the pages, and see immediatelly what happens on
the parent frameset page ?
Web pages do not have a size at all, you can't set it the way you are
asking. It is up to you to make sure you do not put any content wider than
the boundry you don't wish to cross. The best way to do this is to create a
new, fresh, blank web page and place a 1 row, 1 column table on it that is
770px wide with the border turned off. Then, you build your web page inside
this table, making sure not to put anything into it that is wider than
770px.

9) I have an sln project, and for reason I don't know, now I cannot see
the sources of html pages, in a single one page.
What I see is only one of the sources of the pages (i.e main.htm) and I
need each time to double click on the relevant page on the sln explorer,
in oreder to see it.
What's wrong.


It doesn't sound like anything is wrong. Each page should open up in its
own code window as you double click it from the Solution Explorer. They are
different files. Why would you expect to see the HTML from different files
in one page?

-Scott
Nov 19 '05 #2
Thanks a lot.
some clarifications :
Any server side-code you write will be completed BEFORE the user ever gets
the page to look at in their browser. Therefore, you should always open
... Should I also close the connection on each ASPX page, or is it close
automatically ?

Your code above does not create an instance of anything because the
keyword "new" is not being used. Even if you had used it, you haven't
configured your command's CommandText (like a SQL statement or stored
procedure name), ... Thank you.

My code was just fine (it was in the three dots)
What I did wrong, I see due your code :
I did :
call cmd.executeNone Query
instead of
retVal = cmd.executeNone Query.
That's all.
Web pages do not have a size at all, you can't set it the way you are
asking. It is up to you to make sure you do not put any content wider
than ....
Thank you.
It doesn't sound like anything is wrong. Each page should open up in its
own code window as you double click it from the Solution Explorer. They
are different files. Why would you expect to see the HTML from different
files in one page?


You understood me wrongly.
There should be a page-tab (like you see at bottom of each *.xls
excel-file).
What I see is not a page tab, that before I saw it.

Another things are my questions to dialog.
Also : I created a dialog, which is an aspx page.
How can I force "killing" from memory the dialogbox.
I have a problem that the calling form remember the dialogbox, and whenever
I open the dialog again,
I don't even get into the form_load event (before the if statement, of
course).
Also my questions about dialog-box have no answers yet :
Dialog-Box
---------------
2) I see that when I use dialog-box (by window.showModa lDialog), and the
dialog is an aspx page - it opens a new session,
can I stay at the same session as before ?
(I see that parameter Session("aaa") which is known in the calling form, is
unknown at the called dialog box) ?
3) What is the command to close the dialog box ?
4) Dialog box has status bar - can I hide it ? can I put my own text on the
status bar (at the bottom line) ?
5) How can I do refresh to the calling form that called the dialogbox just
after it called it ? (calling form is an aspx page).
6) How can I return the window.dialogAr guments, when the dialog-box is an
aspx page ?

Thanks :)
Nov 19 '05 #3
>> Any server side-code you write will be completed BEFORE the user ever
gets the page to look at in their browser. Therefore, you should always
open ... Should I also close the connection on each ASPX page, or is it close
automatically ?


You should open it in each page, do the work you need to do and close it (no
it is not closed automatically [unless you are using a DataAdapter, which it
sounds like you are not]) on each page.
Your code above does not create an instance of anything because the
keyword "new" is not being used. Even if you had used it, you haven't
configured your command's CommandText (like a SQL statement or stored
procedure name), ...

Thank you.

My code was just fine (it was in the three dots)
What I did wrong, I see due your code :
I did :
call cmd.executeNone Query
instead of
retVal = cmd.executeNone Query.
That's all.


Well, you said that you were getting an error and you didn't provide all
your code, so I assumed that what you did provide was all you wrote. My
retVal variable does not need to be included to prevent your error. It's
just there to get the return value (of how many records are affected by the
command).

Web pages do not have a size at all, you can't set it the way you are
asking. It is up to you to make sure you do not put any content wider
than ....


Thank you.
It doesn't sound like anything is wrong. Each page should open up in its
own code window as you double click it from the Solution Explorer. They
are different files. Why would you expect to see the HTML from different
files in one page?


You understood me wrongly.
There should be a page-tab (like you see at bottom of each *.xls
excel-file).
What I see is not a page tab, that before I saw it.


Try going into Tools...Options and on the first section, hit the Reset
Window Layout button and look again.
Also my questions about dialog-box have no answers yet :
Dialog-Box


I didn't answer the dialog box questions because I didn't understand them.
You have to remember that all the code in an .aspx page is server-side code.
That is, code that is processed on the server BEFORE the client recieves the
page. Generally speaking, you don't use dialog boxes on web pages. You use
them in a Windows Forms application.

Nov 19 '05 #4
Thank you for all your answers.
Except the dialog box, all answered were replied - thank you very much.

For the dialog-box :

In the asp page, I have linked a datagrid to a table (users).
The datagrid is called : dsUsers.

In the ItemDatabound event, I add the event of some of my edit button, to do
: open a dialog box.
(So, I persume this happens before the code is send to client,
and that's how on aspx, I call another aspx form, that is in a dialog box.
Also the code is web project, that is under the sln applications,
and under that project, there are pages, such as aspx, etc...,
so it is a web project, that I can run at the internet, isn't it ?)

Here is the code :
-----------------------

Private Sub dgUsers_ItemDat aBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgUsers.ItemDat aBound
Dim editBtn As LinkButton

Dim btn As Button

Dim s As String

If e.Item.ItemInde x <> -1 Then

If e.Item.ItemType = ListItemType.It em Or ListItemType.Al ternatingItem Then

btn = CType(e.Item.Ce lls(0).Controls (0), Button)

s = e.Item.Cells(8) .Text

btn.Attributes. Add("onclick", _

String.Format(" window.showModa lDialog('myAspP age.aspx?user_i d=" & s & "',
'', 'dialogHeight:5 75 ;dialogWidth:60 0px;center=yes' )"))

-----------

It also works, and open the dialog.
The related dialog box is for myAspPage.aspx.
The related caling aspx is myCallAsp.aspx.

Now, again let's return to the questions about dialog, I have asked.

Thanks :)
Nov 19 '05 #5
I think you are going about the Edit button incorrectly. There is no need
to register an event handler for a link button at all. Just add a Button
column to the DataGrid and your grid will respond to the edit linkButton's
click automatically with the EditCommand event handler. The grid will then
automatically switch into "edit mode" so the user can edit the data. There
is no need for a dialog box at all.

Here's the HTML for the DataGrid:

<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:EditComman dColumn ButtonType="Lin kButton"
UpdateText="Upd ate"
CancelText="Can cel"
EditText="Edit" >
</asp:EditCommand Column>
</Columns>
</asp:DataGrid>

And, here's the code-behind code to handle the clicking of the button:

Private Sub DataGrid1_EditC ommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.EditC ommand

End Sub

And yes, as I've said, ALL server-side code is execute BEFORE the client
(browser) ever gets anything. Also, if you have .aspx pages, then yes, you
are making a web application which runs over the Internet.
"Eitan" <no****@nospam. com> wrote in message
news:er******** ******@TK2MSFTN GP12.phx.gbl...
Thank you for all your answers.
Except the dialog box, all answered were replied - thank you very much.

For the dialog-box :

In the asp page, I have linked a datagrid to a table (users).
The datagrid is called : dsUsers.

In the ItemDatabound event, I add the event of some of my edit button, to
do : open a dialog box.
(So, I persume this happens before the code is send to client,
and that's how on aspx, I call another aspx form, that is in a dialog box.
Also the code is web project, that is under the sln applications,
and under that project, there are pages, such as aspx, etc...,
so it is a web project, that I can run at the internet, isn't it ?)

Here is the code :
-----------------------

Private Sub dgUsers_ItemDat aBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgUsers.ItemDat aBound
Dim editBtn As LinkButton

Dim btn As Button

Dim s As String

If e.Item.ItemInde x <> -1 Then

If e.Item.ItemType = ListItemType.It em Or ListItemType.Al ternatingItem
Then

btn = CType(e.Item.Ce lls(0).Controls (0), Button)

s = e.Item.Cells(8) .Text

btn.Attributes. Add("onclick", _

String.Format(" window.showModa lDialog('myAspP age.aspx?user_i d=" & s & "',
'', 'dialogHeight:5 75 ;dialogWidth:60 0px;center=yes' )"))

-----------

It also works, and open the dialog.
The related dialog box is for myAspPage.aspx.
The related caling aspx is myCallAsp.aspx.

Now, again let's return to the questions about dialog, I have asked.

Thanks :)

Nov 19 '05 #6
> Here's the HTML for the DataGrid:

<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:EditComman dColumn ButtonType="Lin kButton"
UpdateText="Upd ate"
CancelText="Can cel"
...


No !!!
I know that kind option, but I don't want to ...

I want to open a dialog box for kind of reason,
and I need the code behinds.

Why not just answer my several questions, as before.
Again (the same forgotten 6 questions) :

Dialog-Box
---------------
2) I see that when I use dialog-box (by window.showModa lDialog), and the
dialog is an aspx page - it opens a new session,
can I stay at the same session as before ?
(I see that parameter Session("aaa") which is known in the calling form, is
unknown at the called dialog box) ?
3) What is the command to close the dialog box ?
4) Dialog box has status bar - can I hide it ? can I put my own text on the
status bar (at the bottom line) ?
5) How can I do refresh to the calling form that called the dialogbox just
after it called it ? (calling form is an aspx page).
6) How can I return the window.dialogAr guments, when the dialog-box is an
aspx page ?
------

Thanks :)
Nov 19 '05 #7
I have told you why I haven't answered your dialog questions. Because I
don't have too much information about this particular method.
"ShowModelDialo g" is an IE proprietary method of the client-side "window"
object. I don't use proprietary objects, properties and methods.

I can tell you that whenever you open a new browser window, you get a new
session. There is nothing you can do about that.

A simple msdn search reveals quite a bit of information
(http://msdn.microsoft.com/library/de...odaldialog.asp)

Among other things, this url explains how to pass data into this window.

In additon, the JavaScript command to close the current window is:
self.close()

"Eitan" <no****@nospam. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Here's the HTML for the DataGrid:

<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:EditComman dColumn ButtonType="Lin kButton"
UpdateText="Upd ate"
CancelText="Can cel"
...


No !!!
I know that kind option, but I don't want to ...

I want to open a dialog box for kind of reason,
and I need the code behinds.

Why not just answer my several questions, as before.
Again (the same forgotten 6 questions) :

Dialog-Box
---------------
2) I see that when I use dialog-box (by window.showModa lDialog), and the
dialog is an aspx page - it opens a new session,
can I stay at the same session as before ?
(I see that parameter Session("aaa") which is known in the calling form,
is
unknown at the called dialog box) ?
3) What is the command to close the dialog box ?
4) Dialog box has status bar - can I hide it ? can I put my own text on
the
status bar (at the bottom line) ?
5) How can I do refresh to the calling form that called the dialogbox just
after it called it ? (calling form is an aspx page).
6) How can I return the window.dialogAr guments, when the dialog-box is an
aspx page ?
------

Thanks :)

Nov 19 '05 #8

"Scott M." <s-***@nospam.nosp am> wrote in message
news:OO******** *****@TK2MSFTNG P12.phx.gbl...
I have told you why I haven't answered your dialog questions. Because I
don't have too much information about this particular method.
Well, say so.
I can tell you that whenever you open a new browser window, you get a new
session. There is nothing you can do about that.

A simple msdn search reveals quite a bit of information
(http://msdn.microsoft.com/library/de...odaldialog.asp)

Among other things, this url explains how to pass data into this window.

In additon, the JavaScript command to close the current window is:
self.close()


Thanks :)
I'll go that link.
Nov 19 '05 #9

"Eitan" <no****@nospam. com> wrote in message
news:uN******** *****@TK2MSFTNG P09.phx.gbl...

"Scott M." <s-***@nospam.nosp am> wrote in message
news:OO******** *****@TK2MSFTNG P12.phx.gbl...
I have told you why I haven't answered your dialog questions. Because I
don't have too much information about this particular method.


Well, say so.


I did. Just go back and look at my responses.
Nov 19 '05 #10

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

Similar topics

2
1784
by: michela rossi | last post by:
Hi, Don't know if anyone can help me. I've got the following questions: 1. Does anyone know of anywhere that offers shared webspace which has support for Java/JSP? Ideally running Tomcat? 2. Is there any driver/support in JSP for writing to a text file? E.g. a website that receives many thousand submissions/day via a feedback form - rather than simply send emails, desire is to put them all into one text file per day then email that...
1
1993
by: Torsten Mohr | last post by:
Hi, i'd like to write an extension module and use PyArg_ParseTuple in that to parse the parameters. I have several questions related to this that i did not find in the documentation: 1. I'd like to check for a list of "int"s and i don't know how many int's are in this array, it could be
0
1136
by: Victor Porton | last post by:
Suppose I create several RSS channels: http://example.com/company-news.rdf http://example.com/new-products.rdf http://example.com/product-updates.rdf etc. They are interrelated: for example, new-products would be a subset of company-news. So the questions:
5
6550
by: NotGiven | last post by:
I have a form with several questions. Within each question there are several checkboxes. I need to ensure that the user checks at least one checkbox. They can check more but must check at least one. How would I do this in Javascript? Many thanks.
1
1319
by: Ayende Rahien | last post by:
I'm storing my data inside an XML file, the data is divided into several niches. I expect two things to happen during normal use of the application: A> Number of niches to grow. B> Amount of information in niche would grow. This would result in one big file, it's not too much trouble to change it now to mutliply files, the question is what would be better from design and performance perspective? Several other questions:
0
1478
by: Chad A. Beckner | last post by:
I am starting to work on implementing ASP.NET (using VS.NET Dev 2003) into our current ASP 3.0 intranet setup. We have several (say 15 - 20) "applications" that are run within our intranet, which leads me to the following questions: 1. I currently use an ISAPI filter to "force" all pages to run through a page called site_template.asp. This file "templates" the pages with common code and a page "skin". This forces all pages (whether...
2
1813
by: Tiago Miguel Silva | last post by:
Hi there to all. I am a .NET Crystal newbie and I hope that you don’t pick me up much :) with the following questions: 1) It’s possible to access the report model to alter the rendered data. I’m talked about a process like .NET data grid, where we can iterate thru the rows and change data. 2) I have a report with a linked sub report. The data targets the same data
7
2228
by: Byron | last post by:
I have several user controls that have a few methods in common, such LoadFromForm() which populates an object from controls on the form. I want to call that method from the form in which the control is contained regardless of the type currently displayed without having to use a huge switch somthing like: switch(curentUserType.GetType()) { case "Person": ((person)currentUserControl).LoadFromForm();
1
221
by: Joe | last post by:
Dear all, I have many questions, please help! 1.) If i use the backup/restore function in the IIS, does the backup includes only the register and settings of web sites in the IIS only, or does it include the file together? 2.) If i create a web sites have several hundred of static html pages, however all the pages need to check whether the user is login or not , if not, it will redirect to login page. For this, I think to create a aspx...
0
8375
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
jinu1996
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...
0
8593
tracyyun
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...
0
7306
agi2029
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...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1593
bsmnconsultancy
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...

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.