|
im doing a samle project that i want to include in my project..
here is the sample code...
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace=System.Web.HttpException %>
<title>Northwind Database Login
Sub doInsert(Source as Object, E as EventArgs)
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("C:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb") & ";"
Dim MySQL as string = "Insert into Members (uid, pwd, fullname, email) " & _
"Values (@uid, @pwd, @fullname, @email)"
Dim MyConn As New Data.OleDb.OleDbConnection(strConn)
Dim Cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New Data.OleDb.OleDbParameter("@uid", frmuid.Text))
.Add(New Data.OleDb.OleDbParameter("@pwd", frmpwd.Text))
.Add(New Data.OleDb.OleDbParameter("@fullname", frmfullname.Text))
.Add(New Data.OleDb.OleDbParameter("@email", frmemail.Text))
End With
MyConn.Open()
cmd.ExecuteNonQuery()
MyConn.Close
'Put a label on your page to contain the 'success' response:
lblMessage.Text = "Thank you for signing up. An email will be sent to you shortly." & _
"Your response will be needed from that email to activate your account"
End Sub
uid | <asp:textbox id="frmuid" runat="server"> | pwd | <asp:textbox id="frmpwd" runat="server"> | fullname | <asp:textbox id="frmfullname" runat="server"> | email | <asp:textbox id="frmemail" runat="server"> | <asp:button
id="button1"
="" onclick="doInsert" text="Submit" runat="server">
|
<asp:label id="lblMessage" runat="server" width="288px" forecolor="#C00000" font-size="Medium"
="" font-italic="True" font-bold="True">
--this code is like a Simple Log in and insert the data in the database.. a made already a blank database..but when i run it this is the error i've got
-System.web.HtppException-{"'(URL HERE or Data Path)\userId.mdb' is not a valid virtual path."}
-would someone describe what is the meaning of this error and what would be the solution or whatever?
_Thanks for helping
|
|
|
|
|
You are using a physical address in the call to Server.MapPath. This is not possible, as Server.MapPath is used to turn a virtual path into a physical path, so it expects a virtual path.
Just remove the call to Server.MapPath, as you already have a physical path.
---
single minded; short sighted; long gone;
|
|
|
|
|
It looks like some sort of issue with the path to the Access database that you are using. As far as I'm aware the Server.MapPath works on the same file structure as your web pages would. Eg ../database/userId.mdb instead of C:\Documents and Settings\Joy.PHOENIX-1D0486C\Desktop\userId.mdb . So put your database either in the root of your site or in a folder, named database, within the root like I have in my example path.
|
|
|
|
|
hi
ive designed a website and i want to upload it.
it uses SQL Server Express database (i store my databases in App_Data)
i use |DataDirectory| for my conection string but when i upload it it says that it has a bad Argument for attachDBFileName.
i want to know how should i upload my database? (my nonDatabase pages work fine)
i uploaded it with the Control Panel's Database Manager but when i use my new connection string it fails.
my connection is:
"server='www.host.com';User ID='admin';Password='pas';Initial Catalog='database';Connect Timeout=30"
but it says:
Cannot open database "database" requested by the login. The login failed.
Login failed for user 'admin'.
what should i do?
oh, one important thing i forgot to say is that i use Membership. how should i upload that database? i have no access to Membership database connection string
|
|
|
|
|
I am developing an application in asp.net and using C# for any code requirements.
I am bringing an old ASP project over to asp.net. The old asp project used JavaScript for much of the coding. I am trying to perform a javascript function in the C# world.
Here is the old JavaScript function:
function LoadMenuBar()
{
window.parent.parent.DisplayMenuBar.location = "menu_bar.asp";
return;
}
This function would send the menu_bar.asp file to a frame segment named DisplayMenuBar. Here is the HTML code that defines DisplayMenuBar:
My question is, how do I perform this same functionality in asp.net using C# as the code environment?
Would be very greatful for any suggestions/help/etc on this issue.
Vern
|
|
|
|
|
See displaying file is always an event that is easy to achieve in Client side. Do go for C# code for the sake of doing everything in C#.
C# is a server side language it is not a client side language.
So please use the same javascript to display( i.e. load) the aspx page.
Thanks,
Arindam D Tewary
|
|
|
|
|
Thanks for the reply. Sometimes the easy answer is so easy you cannot see it.
I will take your advise.
Thanks again, Vern
|
|
|
|
|
I am trying to execute a client side JavaScript function to send a page to a particular frame location. This is how I am doing it:
On the page being loaded, I have the following form definition:
<form
id="frmSelectionFunction"
="" onload="LoadMenuBar()">
I need the LoadMenuBar function to execute (on the client). So I removed the runat=”server” property form the form element.
Everything seems to run OK, except the LoadMenuBar function does not execute when the form is loaded.
This is the LoadMenuBar function:
function LoadMenuBar()
{
alert("Got Here");
window.parent.parent.DisplayMenuBar.location = "menu_bar.aspx";
return;
}
This script code is inserted in the page that gets loaded.
I guess my question is, why is the LoadMenuBar function not being executed?
Thanks, Vern
|
|
|
|
|
How do you work with the gridview and formview in ASP.NET so that a table updates when a user selects to update??
Ty
|
|
|
|
|
You have to use objectdatesource or sqldatasoruce or accessdatasouce
which will make your life easy.
Naveed Kamboh
Complexity kills, Write easy code for your self.
isolutionteam
|
|
|
|
|
hello there,again i need ur help..if i can access the data in mydatabase,lyk entering the correct password and username.how can i code opening new window when this data is correct?.i put a code in and in the button tag asp:button PostBackUrl="index.aspx",the question is the following attributes in the tag given can affect direct opening new window when the corrct Username and Password is correct?...should i used method="get" in form tag/what is the difference between the "GET" and "POST"?what is commonly used form attribute?thankx 4 helping
Im A nEWBIE programmer
|
|
|
|
|
This has to be a problem that's been solved a million times.
I need my website to create pages on the fly from a database.
Because I want Google to like my site, I don't want to use arguments: www.sitename.com\thePage.aspx?Arg1&arg2
So if you will imagine that I have a link to a page that looks like: www.sitename.com\page_arg1_arg2.aspx...
That page doesn't exist, but it looks like a real page to the search engines.
The two options that I've tried are:
1. Use 404 error trapping - but I get the error message in the browser which is ugly and probably disdained by Google. Perhaps there is a combination of transferring and setting environment settings that would make this work.
2. Use virtualPathProvider, and virtualFile. I like this solution, but I can't get it to work. Specifically, the virtualfile.getfile function is never accessed for the aspx. It is only accessed after an aspx file is interpreted (say for a jpg). Apparently the 404 error supercedes this call.
To complicate this further, I'd like to use an existing page, but pass it arguments. I'm supposing that I would have a line of code like this:
new LikeThisPage(arg1,arg2) ' from arg1_arg2.aspx<br />
then somehow used an htmltextwriter to render it to a stream?
Any ideas?
Thanks,
Grant
Everyone else's job looks easy
Everyone else's job looks easy
|
|
|
|
|
Google doesn't have any issues with arguments in the URL so there's no reason not to use them. I think your basically asking how to perform a friendly URL system that allows your to forward shorter, more english URL's on to their original more coplex ones. Eg
www.thissite.com/weather forwards to www.thissite.com/default.aspx?ShowWeather=True
This is used primarily to improve the user experience rather than improving things for the likes of search engines. Search google for asp.net friendly URLS.
|
|
|
|
|
I am developing a web application using C#.net and ASP.net.
I want to export some data to ms-word as report.
I got it now.
However, one problem is there.
If the html page contains any image, then the word document will store a REFERENCE URL to the image (I tried to save as a .doc file). So, when that image gets deleted from the server or the word document is moved to another place, the image disappears from the document!
What I need is:
How can we make the image be integrated/embedded in word document so that it remains there even after it is deleted from its location?
Thanks
|
|
|
|
|
Is there any way of grouping ASP.NET controls together?
I'd like to set a group of controls as invisible rather than having to set each individual control as invisible. Just want to cut down on the amount of code and make it more readable.
|
|
|
|
|
Use a PlaceHolder server control. That is a really good way of making a group of control visible or invisible.
Ben
|
|
|
|
|
You can use an <asp:Panel /> control, too.
Jon Sagara
This is the stuff we'll drink on special occasions. To paraphrase my father-in-law, this is the kind of wine that results in kids.
-- A friend
Blog | Site | Articles
|
|
|
|
|
Hi guys, I am thinking about how to implement if a user click on a link button out of three links to open a popup window and if a user click on a different link then close the existing popup window and reopen the popup with different contents in it.
Can somebody provide me some examples. I know how to open a window but if somebody has any idea i shall appreciate.
Thanks
|
|
|
|
|
You can use a variable in the Session object to store what the user choose in the popup.
So, in the main page you check what the user chose (an example, a AJAX timer that checks the value of the variable in Session object) and open the appropriate popup.
Or else, you can simulate a pop-up window by using DIV(s) and AJAX.
Bye,
Carmine,
Webmaster of: www.thetotalsite.it
My web blog: blog.thetotalsite.it
|
|
|
|
|
Dear all,
I have a web page from which I want to ping to a specific IP,could any one help me in how to do that using C#
Thanks
|
|
|
|
|
|
Hi
I am developing a small application with some attributes:
- 1 Master Page
- 3 Content Pages
- 2 User Controls
I am calling the user controls in my Master page in order to gain consistency.
One of the usercontrol is Login (with Password and UserName text boxes and Login button)
The second usercontrol is Navigation (containing Navigation buttons)
One of the Content Page contains data to create a New user (few text boxes-with requiredfield validation, and Submit button)
The Problem is that the Master and Page content are strongly coupled.
when I Press some Login button in the Login UserControl (contained inside the Master page), Validation on the Content page is automatically fired and vice a versa.
What I am interested in is that Login User control should be completely independent and so as my content page. The request in the content page should ONLY fire validations in the content page and NOT on my login Textboxes or vice a versa.
Any suggestions !
|
|
|
|
|
Set the ValidationGroup property on the inputs and submit buttons.
|
|
|
|
|
Thank you, that solves it...
Another question with the validation groups.
I am unable to validate the controls within the update panel.
any Ideas..
Thank you again
|
|
|
|
|
Is there a way to create a table on the server and create a simple command like the HtmlGenericControl has a InnerHtml property. Idea here to allow an Callback to return a string that has the contents of that could be used to update the table without a full Postback.
JavaScript example:
function UpdateTable(result, context)
{
document.getElementById('localList').innerHtml = result;
return false;
}
Currently it looks like I would have to iterate through the table, table rows, and finally the table cells recreating all my tags one at a time. This can be messy and easy to forget to check for some value that could be set by a programmer.
Thanks,
Leo T. Smith
|
|
|
|