Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Thursday, March 29, 2012

Please anyone has confirm message box with yes No buttons in it for asp.net page

Please i am looking for a javascript code to use with confirm message box with two buttons Yes and NO in it.

Thank you very much.How about 'OK' and 'Cancel'?

if that's ok - check out :
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=confirm
Hello David,
Thank's a lot, I will try the messagebox code.

please can someone explain the following code.

Hi Christian,

Thanks for the reply, but this is what I don't understand.... (by the way
there was a typo in my last message: "dpPageInit" should be "doPageInit").

I am new to inheritance, but I understand that if I create a classA that
inherits from classB then classA will expose properties/methods of classB.
The things I don't understand are code like:

a) override
b) +=
c) this.Init += new System.EventHandler

I am trying to create a page template (ie: a template page that contains a
header and footer), and then I want each of my pages to inherit the template
page so all I have to do is add the main body of the ASP page (the header
and footer will automatically be rendered by the template page).

I have downloaded the code from the following place
http://www.aspnetui.com/templates/ but I cant get it to work when I try it
myself. On top of that I think they have made the example more complex than
it needs to be.

All I want is a template that looks just like their red example. If someone
could post a simplified version of it it would be great.

"Christian" <pleasenononospamcmillotti@dotnet.itags.org.novasoftware.it> wrote in message
news:%23go0RMpVDHA.2316@dotnet.itags.org.TK2MSFTNGP09.phx.gbl...
> Hi Suzy
> It seems to me that you are in an inherited class, you are overriding
> virtual method OnInit in order to subscribe dbPageInit to be called in the
> Init Event, dbPageLoad to be called In the Load Event and calling OnInit
> method on base class ( that inherited from )...
> What else aren't you understanding?
> In case give details..
> Christian.
> "suzy" <me@dotnet.itags.org.nospam.com> ha scritto nel messaggio
> news:%23%23Wf4EpVDHA.532@dotnet.itags.org.TK2MSFTNGP09.phx.gbl...
> > please can someone explain the following code to a newbie... thanks
> > override protected void OnInit(EventArgs e)
> > {
> > this.Init += new System.EventHandler(dpPageInit);
> > this.Load += new System.EventHandler(doPageLoad);
> > base.OnInit(e);
> > }a) override:
If you have:
Class MyClass
{
...
protected virtual void MyMethod()
{
// Some instructions
...
}
}
MyMethod is the first implementation of the method.
You could have your ownn MyMethod in your class:
Class MySecondClass : Myclass
{
protected override void MyMethod()
{
// other instructions
...
}
}
You can override only virtual methods.

b) += :
add something to... for example:

c) this.Init += new System.EventHandler( doPageInit ):
add doPageInit method to delegate list called by Init event.
( Is Init an event ? )
When Init event is fired your class iterates through delegate: (
System.EventHandler is our delegate )
and call all methods subscribed
you subscribe your own method ( that must have the signature given by
delegate as return type, parameters, etc ) by writng
... += new System.EventHandler( doPageInit ):

Do you know what delegates are?

"suzy" <me@.nospam.com> ha scritto nel messaggio
news:eOF6lbpVDHA.2328@.TK2MSFTNGP12.phx.gbl...
> Hi Christian,
> Thanks for the reply, but this is what I don't understand.... (by the way
> there was a typo in my last message: "dpPageInit" should be "doPageInit").
> I am new to inheritance, but I understand that if I create a classA that
> inherits from classB then classA will expose properties/methods of classB.
> The things I don't understand are code like:
> a) override
> b) +=
> c) this.Init += new System.EventHandler
>
> I am trying to create a page template (ie: a template page that contains a
> header and footer), and then I want each of my pages to inherit the
template
> page so all I have to do is add the main body of the ASP page (the header
> and footer will automatically be rendered by the template page).
> I have downloaded the code from the following place
> http://www.aspnetui.com/templates/ but I cant get it to work when I try it
> myself. On top of that I think they have made the example more complex
than
> it needs to be.
> All I want is a template that looks just like their red example. If
someone
> could post a simplified version of it it would be great.

> > "suzy" <me@.nospam.com> ha scritto nel messaggio
> > news:%23%23Wf4EpVDHA.532@.TK2MSFTNGP09.phx.gbl...
> > > please can someone explain the following code to a newbie... thanks
> > > > override protected void OnInit(EventArgs e)
> > > {
> > > > this.Init += new System.EventHandler(dpPageInit);
> > > this.Load += new System.EventHandler(doPageLoad);
> > > base.OnInit(e);
> > > }
> >
> Thanks for your reply. No I don't know what delegates are. :-(

should take a look..
> Also, in your example of MyClass/MyMethod in which order will the code be
> run?
MyClass.MyMethod is 1 implementation
MySecondClass.MyMethod is another 1
they are not tied
public Class MyClass
{
...
protected virtual void MyMethod()
{
// Some instructions
MessageBox.Show( "1" );
}
protected virtual void AnotherMethod()
{
MessageBox.Show( "Hello" );
}
}
MyMethod is the first implementation of the method.
You could have your ownn MyMethod in your class:
public Class MySecondClass : Myclass
{
protected override void MyMethod()
{
// other instructions
MessageBox.Show( "2" );
...
}
protectd override AnotherMethod()
{
base.AnotherMethod();
MessageBox.Show( "Suzy" );
}
}
MyClass cl = new MyClass();
cl.MyMethod(); // displays 1
cl.AnotherMethod(); // displays Hello
MySecondClass cl2 = new MySecondClass();
cl2.MyMethod(); // displays 2
cl2.AnotherMethod(); // displays Hello and then Suzy

talking about delegates and events

this.Load += new System.EventHandler(doPageLoad);
this.Load += new System.EventHandler(doPageAnotherLoad);
this.Load += new System.EventHandler(doPageAnotherOneLoad);

On Load Fired will be executed
doPageLoad(), doPageAnotherLoad(), doPageAnotherOneLoad(), i think in order
of submission

> Someone said the following code would create a template if placed in a
page
> template class:
Sorry, i'm not the proper person for help you with asp... never worked :-(
Repost for detailed and specific helps.

> protected override void OnInit (EventArgs args)
> {
> this.Controls.AddAt(0, LoadControl("path to header.ascx " );
> base.OnInit(e);
> this.Controls.Add(LoadControl("path to footer.ascx"));
> }
> And the code in my page that inherited the above contained the
following...:
> override protected void OnInit(EventArgs e)
> {
> InitializeComponent();
> base.OnInit(e);
> }
> private void Page_Load(object sender, System.EventArgs e)
> {
> placeholder.Controls.Add (grdDataGrid);
> }
> They said this should place my placeholder/datagrid between a
header/footer.
Thanks, that explains a lot! Much appreciated!

I think I am right in saying that if I inherited a template class containing
the code below in it, then it won't place a header/footer around my ASP code
(of the page that inherits the template class).

protected override void OnInit (EventArgs args)
{
this.Controls.AddAt(0, LoadControl("path to header.ascx" );
base.OnInit(e);
this.Controls.Add(LoadControl("path to footer.ascx"));
}

"Tom" <TomRemoveThisClement@.sbcglobal.net> wrote in message
news:uMKACrzVDHA.2156@.TK2MSFTNGP11.phx.gbl...
> Hi Susy,
> A delegate (or an event) is an kind of pointer to functions. The
difference
> between an event and an ordinary pointer is that inside of the event is a
> list of pointers to functions. If you "call" the event it's called
raising
> the event and every function that has been added to the event is called in
> order.
> The way this is typicaly used in C# is if you have a class in which things
> can occur that might be of interest to others, you can declare a public
> event (like "event EventHandler Load;") Any other object that is
interested
> in (i.e wants to be notified of) this occurance (Load) registers this
> interest by adding a pointer to a function in the event. So when you see
> the code:
> this.Load += new System.EventHandler(doPageLoad);
> you are looking at an expression of interest in the Load event. When it
> occurs, the doPageLoad() function will be called (along with any other
> functions that have been registered with the Load event using the +=
syntax.
> The odd thing about this code is that it it registering with an event on
the
> same object as the current instance. There are better (or at least more
> natural) ways of accomplishing this. First, if (as is likely) the Load
> event is declared in a superclass (a class from which this current class
was
> derived - directly or indirectly) you would typically override a protected
> OnLoad() method to obtain the notification of Load. Second, if the event
is
> declared in the same object as the += code, you'd typically just call a
> function directly instead of raising an event and receiving notification
for
> it.
> Tom
> "suzy" <me@.nospam.com> wrote in message
> news:%23PoQfkrVDHA.3088@.tk2msftngp13.phx.gbl...
> > great, i am starting to understand more:
> > i thought it worked the way you say it worked, that's why i didn't
> > understand the theory behind he code that was submitted to me regarding
> the
> > page hearder/footer (shown below):
> > > protected override void OnInit (EventArgs args)
> > > {
> > > this.Controls.AddAt(0, LoadControl("path to header.ascx " );
> > > base.OnInit(e);
> > > this.Controls.Add(LoadControl("path to footer.ascx"));
> > > }
> > if the above code is in my base/template class (A), i can't see how i
can
> > write code in a class that inherits from it (B), so that my code from B
> gets
> > inserted between the header/footer.
> > i know you said you haven't done asp.net, but doesn't the theory of it
> sound
> > wrong to you?
> > "Christian" <pleasenononospamcmillotti@.novasoftware.it> wrote in message
> > news:uE5jGJrVDHA.532@.TK2MSFTNGP10.phx.gbl...
> > > > > Thanks for your reply. No I don't know what delegates are. :-(
> > > > should take a look..
> > > > > > Also, in your example of MyClass/MyMethod in which order will the
code
> > be
> > > > run?
> > > MyClass.MyMethod is 1 implementation
> > > MySecondClass.MyMethod is another 1
> > > they are not tied
> > > public Class MyClass
> > > {
> > > ...
> > > protected virtual void MyMethod()
> > > {
> > > // Some instructions
> > > MessageBox.Show( "1" );
> > > }
> > > protected virtual void AnotherMethod()
> > > {
> > > MessageBox.Show( "Hello" );
> > > }
> > > }
> > > MyMethod is the first implementation of the method.
> > > You could have your ownn MyMethod in your class:
> > > public Class MySecondClass : Myclass
> > > {
> > > protected override void MyMethod()
> > > {
> > > // other instructions
> > > MessageBox.Show( "2" );
> > > ...
> > > }
> > > protectd override AnotherMethod()
> > > {
> > > base.AnotherMethod();
> > > MessageBox.Show( "Suzy" );
> > > }
> > > }
> > > MyClass cl = new MyClass();
> > > cl.MyMethod(); // displays 1
> > > cl.AnotherMethod(); // displays Hello
> > > MySecondClass cl2 = new MySecondClass();
> > > cl2.MyMethod(); // displays 2
> > > cl2.AnotherMethod(); // displays Hello and then Suzy
> > > > talking about delegates and events
> > > > this.Load += new System.EventHandler(doPageLoad);
> > > this.Load += new System.EventHandler(doPageAnotherLoad);
> > > this.Load += new System.EventHandler(doPageAnotherOneLoad);
> > > > On Load Fired will be executed
> > > doPageLoad(), doPageAnotherLoad(), doPageAnotherOneLoad(), i think in
> > order
> > > of submission
> > > > > > > Someone said the following code would create a template if placed in
a
> > > page
> > > > template class:
> > > Sorry, i'm not the proper person for help you with asp... never worked
> :-(
> > > Repost for detailed and specific helps.
> > > > > protected override void OnInit (EventArgs args)
> > > > {
> > > > this.Controls.AddAt(0, LoadControl("path to header.ascx " );
> > > > base.OnInit(e);
> > > > this.Controls.Add(LoadControl("path to footer.ascx"));
> > > > }
> > > > > > And the code in my page that inherited the above contained the
> > > following...:
> > > > > > override protected void OnInit(EventArgs e)
> > > > > > {
> > > > > > InitializeComponent();
> > > > > > base.OnInit(e);
> > > > > > }
> > > > > > private void Page_Load(object sender, System.EventArgs e)
> > > > > > {
> > > > > > placeholder.Controls.Add (grdDataGrid);
> > > > > > }
> > > > > > They said this should place my placeholder/datagrid between a
> > > header/footer.
> > > >

Please correct this error

please correct this error while debugging

it show the message box like this when we start the debugging in dot net 2003
But IIS is working properly.if i go for debugging it give this error.

Actually i have loaded 2003 and 2005 in single operating system , but don't say remove 2005 it working properly.

"Error while trying to run project : Unable to start debugging on the web ser server"

Click Help for More Information

OK Help

Plz help me.......... i am unable work without debugging some times.
if any one know reply me

Thx in advance

Hi

you have <compilation debug="false" /> in we.config

change it to <compilation debug="true" />


Hi,

Check out my post on the same topic:

http://geekswithblogs.net/vivek/archive/2006/09/12/90930.aspx

HTH,

Vivek

Monday, March 26, 2012

Please help - What am I missing?

Why are my ASP.NET apps giving me this message? I am unable to get anything
to work. Thanks for any help.
Server Application Unavailable

Regards,
CK"Chris Kettenbach" <chris@.piasd.org> wrote in message
news:JJ6dnSXFSdcPSB_cRVn-sw@.giganews.com...
> Why are my ASP.NET apps giving me this message? I am unable to get
anything
> to work. Thanks for any help.
> Server Application Unavailable

I've had this problem when I copied application files to the server using
Web-based remote administration tool. And the issue was with file system
access rights. As soon as I allowed ASPNET to read from the directory,
problem was fixed. Try to look in that direction...

Regards,
Dmitry
Check out this faq to know why this error message is coming,
http://www.extremeexperts.com/Net/F...navailable.aspx

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"Chris Kettenbach" <chris@.piasd.org> wrote in message
news:JJ6dnSXFSdcPSB_cRVn-sw@.giganews.com...
> Why are my ASP.NET apps giving me this message? I am unable to get
anything
> to work. Thanks for any help.
> Server Application Unavailable
> Regards,
> CK

Saturday, March 24, 2012

Please HELP ! Compiler Error Message: BC30466: Namespace or type HelloWorldobj for the Imp

Hi, i have created a class called "HelloWorldobj.dll". Yes, i compiled it with VBC.exe. And, no compilation error shown.

I have read an article on teaching people to run custome namespace/classes. It said that we can just create a folder called "bin" inside the web application folder, and put all the classes / calss file inside this "bin" folder.

Then, inside our code, what we need to do is just :
<%@dotnet.itags.org. Import Namespace="HelloWorldobj" %>
...
...
But, it can't work here!!! why? Error msg :

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30466: Namespace or type 'HelloWorldobj' for the Imports 'HelloWorldobj' cannot be found.

Source Error:

Line 13:
Line 14: Imports ASP
Line 15: Imports HelloWorldobj
Line 16: Imports Microsoft.VisualBasic
Line 17: Imports System
Source File: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\hotelex\0fa6dfdb\85a29584\dehxro7g.0.vb Line: 15

I have tried it with another dll "Microsoft.Data.Odbc". it works!
<%@dotnet.itags.org. Import Namespace = "System.Data" %>
<%@dotnet.itags.org. Import Namespace = "Microsoft.Data.Odbc" %>
...
...

Really don't understand..

Can anyone teach me how to apply own class in ASP.NET?
What should i do or what should i set?Did you put the DLL in the application's root /bin folder?
Yes, i did. I have created a folder called "bin" inside my application folder.

Or, do u mind to tell me the step of start a new application? such as ,... what setting should do,.. where to configure,.. how,..
and especially those customer class file...

Or anyone can help?

Please help : System.Data.OleDb.OleDbException: Syntax error in IN

Hello All,

I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message,

System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

And the line it shows in red is

cmd.ExecuteNonQuery()

I have pasted the entire code here. Can someone please give me some clue as what could be wrong. The SQL string looks fine because I pasted the resulting SQL in to MS Access. When I ran the Insert query, it properly added the record in the Access DB.

Thanks,

Joe

<%@dotnet.itags.org. Page Language="VB" Debug="true" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<%@dotnet.itags.org. Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
'Open up a connection to Access database
'Using a DSN connection.
Dim bolfFound, strUsername, bolAlreadyExists
Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source='E:/Inetpub/databases/investors.mdb'")
objConn.Open()

'check state
If Session("strAdmin") <> "test" Then
objConn.Close()
objConn = Nothing
Response.Write("<A HREF=index.aspx'>")
Response.Write("Sorry, looks like your session timed out, please login again.")
Response.Write("</A>")
Response.End()
End If

bolAlreadyExists = False

Dim objDataReader as OledbDataReader
Dim objCommand as New OledbCommand("Select * From Results", objConn)
objDataReader = objCommand.ExecuteReader()

Do While Not (objDataReader.Read()= False OR bolAlreadyExists)
If (StrComp(objDataReader("Email"), Request.Form("Email"), vbTextCompare) = 0) Then
Response.Redirect("record_exists.aspx")
bolAlreadyExists = True
End If
Loop

objDataReader.Close()

If Not bolAlreadyExists Then

Dim Email, passwd, first_name, last_name, company, street_address, address2, city, prov, country, postal, phone, mobilePhone, AddDate,Investor, RemoteIP
Email = Request.Form("Email")
passwd = Request.Form("password")
first_name = Request.Form("first_name")
last_name = Request.Form("last_name")
company = Request.Form("company")
street_address = Request.Form("street_address")
address2 = Request.Form("address2")
city = Request.Form("city")
prov = Request.Form("state")
country = Request.Form("country")
postal = Request.Form("postal")
phone = Request.Form("phone")
mobilePhone = Request.Form("mobile")
AddDate = Now
Inv = "Yes"
RemoteIP = Request.ServerVariables("REMOTE_ADDR")

Dim MySQL as String

MySQL = "INSERT INTO Results(email, password, first_name, last_name, company, street_address, address2, city, state, country, postal, phone, mobile, AddDate, Inv, RemoteIP)" & _
" VALUES('" & Email & "', '" & passwd & "', '" & first_name & "', '" & last_name & "', '" & company & "', '" & street_address & "', '" & address2 & "', '" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '" & phone & "', '" & mobilePhone & "', '" & AddDate & "', '" & Investor & "', '" & RemoteIP & "')"

Dim cmd as New OleDBCommand (MySQL, objConn)

cmd.ExecuteNonQuery ()
End if

objConn = Nothing
objConn.Close()

%I believe 'password' is a keyword - but it is also your column name. Try
putting [ and ] around the column name.

Alsok you shouldn't just concatenate strings together given to you by the
user. They could easily put in malicious SQL for one of those values. I
would recommend using parameters.

"Joe" <Joe@.discussions.microsoft.com> wrote in message
news:46E04C27-2E28-4AF8-B67B-B4492B7F2298@.microsoft.com...
> Hello All,
> I am trying to insert a record in the MS Access DB and for some reason I
cannot get rid of error message,
> System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
> And the line it shows in red is
> cmd.ExecuteNonQuery()
> I have pasted the entire code here. Can someone please give me some clue
as what could be wrong. The SQL string looks fine because I pasted the
resulting SQL in to MS Access. When I ran the Insert query, it properly
added the record in the Access DB.
> Thanks,
> Joe
>
> <%@. Page Language="VB" Debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
> <%@. Import Namespace="System.Data.OleDb" %>
> <%@. Import Namespace="System.Data" %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <%
> 'Open up a connection to Access database
> 'Using a DSN connection.
> Dim bolfFound, strUsername, bolAlreadyExists
> Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source='E:/Inetpub/databases/investors.mdb'")
> objConn.Open()
> 'check state
> If Session("strAdmin") <> "test" Then
> objConn.Close()
> objConn = Nothing
> Response.Write("<A HREF=index.aspx'>")
> Response.Write("Sorry, looks like your session timed out, please login
again.")
> Response.Write("</A>")
> Response.End()
> End If
> bolAlreadyExists = False
> Dim objDataReader as OledbDataReader
> Dim objCommand as New OledbCommand("Select * From Results", objConn)
> objDataReader = objCommand.ExecuteReader()
> Do While Not (objDataReader.Read()= False OR bolAlreadyExists)
> If (StrComp(objDataReader("Email"), Request.Form("Email"), vbTextCompare)
= 0) Then
> Response.Redirect("record_exists.aspx")
> bolAlreadyExists = True
> End If
> Loop
> objDataReader.Close()
> If Not bolAlreadyExists Then
> Dim Email, passwd, first_name, last_name, company, street_address,
address2, city, prov, country, postal, phone, mobilePhone, AddDate,Investor,
RemoteIP
> Email = Request.Form("Email")
> passwd = Request.Form("password")
> first_name = Request.Form("first_name")
> last_name = Request.Form("last_name")
> company = Request.Form("company")
> street_address = Request.Form("street_address")
> address2 = Request.Form("address2")
> city = Request.Form("city")
> prov = Request.Form("state")
> country = Request.Form("country")
> postal = Request.Form("postal")
> phone = Request.Form("phone")
> mobilePhone = Request.Form("mobile")
> AddDate = Now
> Inv = "Yes"
> RemoteIP = Request.ServerVariables("REMOTE_ADDR")
> Dim MySQL as String
> MySQL = "INSERT INTO Results(email, password, first_name, last_name,
company, street_address, address2, city, state, country, postal, phone,
mobile, AddDate, Inv, RemoteIP)" & _
> " VALUES('" & Email & "', '" & passwd & "', '" & first_name & "', '" &
last_name & "', '" & company & "', '" & street_address & "', '" & address2 &
"', '" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '"
& phone & "', '" & mobilePhone & "', '" & AddDate & "', '" & Investor & "',
'" & RemoteIP & "')"
> Dim cmd as New OleDBCommand (MySQL, objConn)
> cmd.ExecuteNonQuery ()
> End if
> objConn = Nothing
> objConn.Close()
> %
Yep..that got me a few times. Also Joe, be careful of using Date as a column name as well, I know you didn't use it here but I had to find out the hard way. It will cause the same type of error. The Jet Provider is picky about those kinds of words

"Marina" wrote:

> I believe 'password' is a keyword - but it is also your column name. Try
> putting [ and ] around the column name.
> Alsok you shouldn't just concatenate strings together given to you by the
> user. They could easily put in malicious SQL for one of those values. I
> would recommend using parameters.
> "Joe" <Joe@.discussions.microsoft.com> wrote in message
> news:46E04C27-2E28-4AF8-B67B-B4492B7F2298@.microsoft.com...
> > Hello All,
> > I am trying to insert a record in the MS Access DB and for some reason I
> cannot get rid of error message,
> > System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
> > And the line it shows in red is
> > cmd.ExecuteNonQuery()
> > I have pasted the entire code here. Can someone please give me some clue
> as what could be wrong. The SQL string looks fine because I pasted the
> resulting SQL in to MS Access. When I ran the Insert query, it properly
> added the record in the Access DB.
> > Thanks,
> > Joe
> > <%@. Page Language="VB" Debug="true" ContentType="text/html"
> ResponseEncoding="iso-8859-1" %>
> > <%@. Import Namespace="System.Data.OleDb" %>
> > <%@. Import Namespace="System.Data" %>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > <%
> > 'Open up a connection to Access database
> > 'Using a DSN connection.
> > Dim bolfFound, strUsername, bolAlreadyExists
> > Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
> source='E:/Inetpub/databases/investors.mdb'")
> > objConn.Open()
> > 'check state
> > If Session("strAdmin") <> "test" Then
> > objConn.Close()
> > objConn = Nothing
> > Response.Write("<A HREF=index.aspx'>")
> > Response.Write("Sorry, looks like your session timed out, please login
> again.")
> > Response.Write("</A>")
> > Response.End()
> > End If
> > bolAlreadyExists = False
> > Dim objDataReader as OledbDataReader
> > Dim objCommand as New OledbCommand("Select * From Results", objConn)
> > objDataReader = objCommand.ExecuteReader()
> > Do While Not (objDataReader.Read()= False OR bolAlreadyExists)
> > If (StrComp(objDataReader("Email"), Request.Form("Email"), vbTextCompare)
> = 0) Then
> > Response.Redirect("record_exists.aspx")
> > bolAlreadyExists = True
> > End If
> > Loop
> > objDataReader.Close()
> > If Not bolAlreadyExists Then
> > Dim Email, passwd, first_name, last_name, company, street_address,
> address2, city, prov, country, postal, phone, mobilePhone, AddDate,Investor,
> RemoteIP
> > Email = Request.Form("Email")
> > passwd = Request.Form("password")
> > first_name = Request.Form("first_name")
> > last_name = Request.Form("last_name")
> > company = Request.Form("company")
> > street_address = Request.Form("street_address")
> > address2 = Request.Form("address2")
> > city = Request.Form("city")
> > prov = Request.Form("state")
> > country = Request.Form("country")
> > postal = Request.Form("postal")
> > phone = Request.Form("phone")
> > mobilePhone = Request.Form("mobile")
> > AddDate = Now
> > Inv = "Yes"
> > RemoteIP = Request.ServerVariables("REMOTE_ADDR")
> > Dim MySQL as String
> > MySQL = "INSERT INTO Results(email, password, first_name, last_name,
> company, street_address, address2, city, state, country, postal, phone,
> mobile, AddDate, Inv, RemoteIP)" & _
> > " VALUES('" & Email & "', '" & passwd & "', '" & first_name & "', '" &
> last_name & "', '" & company & "', '" & street_address & "', '" & address2 &
> "', '" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '"
> & phone & "', '" & mobilePhone & "', '" & AddDate & "', '" & Investor & "',
> '" & RemoteIP & "')"
> > Dim cmd as New OleDBCommand (MySQL, objConn)
> > cmd.ExecuteNonQuery ()
> > End if
> > objConn = Nothing
> > objConn.Close()
> > %>
>

Please help : System.Data.OleDb.OleDbException: Syntax error in IN

Hello All,
I am trying to insert a record in the MS Access DB and for some reason I can
not get rid of error message,
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
And the line it shows in red is
cmd.ExecuteNonQuery()
I have pasted the entire code here. Can someone please give me some clue as
what could be wrong. The SQL string looks fine because I pasted the result
ing SQL in to MS Access. When I ran the Insert query, it properly added the
record in the Access DB.
Thanks,
Joe
<%@dotnet.itags.org. Page Language="VB" Debug="true" ContentType="text/html" ResponseEncodin
g="iso-8859-1" %>
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<%@dotnet.itags.org. Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w
3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
'Open up a connection to Access database
'Using a DSN connection.
Dim bolfFound, strUsername, bolAlreadyExists
Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data so
urce='E:/Inetpub/databases/investors.mdb'")
objConn.Open()
'check state
If Session("strAdmin") <> "test" Then
objConn.Close()
objConn = Nothing
Response.Write("<A HREF=index.aspx'>")
Response.Write("Sorry, looks like your session timed out, please login again
.")
Response.Write("</A>")
Response.End()
End If
bolAlreadyExists = False
Dim objDataReader as OledbDataReader
Dim objCommand as New OledbCommand("Select * From Results", objConn)
objDataReader = objCommand.ExecuteReader()
Do While Not (objDataReader.Read()= False OR bolAlreadyExists)
If (StrComp(objDataReader("Email"), Request.Form("Email"), vbTextCompare) =
0) Then
Response.Redirect("record_exists.aspx")
bolAlreadyExists = True
End If
Loop
objDataReader.Close()
If Not bolAlreadyExists Then
Dim Email, passwd, first_name, last_name, company, street_address, address2,
city, prov, country, postal, phone, mobilePhone, AddDate,Investor, RemoteIP
Email = Request.Form("Email")
passwd = Request.Form("password")
first_name = Request.Form("first_name")
last_name = Request.Form("last_name")
company = Request.Form("company")
street_address = Request.Form("street_address")
address2 = Request.Form("address2")
city = Request.Form("city")
prov = Request.Form("state")
country = Request.Form("country")
postal = Request.Form("postal")
phone = Request.Form("phone")
mobilePhone = Request.Form("mobile")
AddDate = Now
Inv = "Yes"
RemoteIP = Request.ServerVariables("REMOTE_ADDR")
Dim MySQL as String
MySQL = "INSERT INTO Results(email, password, first_name, last_name, company
, street_address, address2, city, state, country, postal, phone, mobile, Add
Date, Inv, RemoteIP)" & _
" VALUES('" & Email & "', '" & passwd & "', '" & first_name & "', '" & last_
name & "', '" & company & "', '" & street_address & "', '" & address2 & "',
'" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '" & ph
one & "', '" & mobilePho
ne & "', '" & AddDate & "', '" & Investor & "', '" & RemoteIP & "')"
Dim cmd as New OleDBCommand (MySQL, objConn)
cmd.ExecuteNonQuery ()
End if
objConn = Nothing
objConn.Close()
%>I believe 'password' is a keyword - but it is also your column name. Try
putting [ and ] around the column name.
Alsok you shouldn't just concatenate strings together given to you by the
user. They could easily put in malicious SQL for one of those values. I
would recommend using parameters.
"Joe" <Joe@.discussions.microsoft.com> wrote in message
news:46E04C27-2E28-4AF8-B67B-B4492B7F2298@.microsoft.com...
> Hello All,
> I am trying to insert a record in the MS Access DB and for some reason I
cannot get rid of error message,
> System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
> And the line it shows in red is
> cmd.ExecuteNonQuery()
> I have pasted the entire code here. Can someone please give me some clue
as what could be wrong. The SQL string looks fine because I pasted the
resulting SQL in to MS Access. When I ran the Insert query, it properly
added the record in the Access DB.
> Thanks,
> Joe
>
> <%@. Page Language="VB" Debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
> <%@. Import Namespace="System.Data.OleDb" %>
> <%@. Import Namespace="System.Data" %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <%
> 'Open up a connection to Access database
> 'Using a DSN connection.
> Dim bolfFound, strUsername, bolAlreadyExists
> Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source='E:/Inetpub/databases/investors.mdb'")
> objConn.Open()
> 'check state
> If Session("strAdmin") <> "test" Then
> objConn.Close()
> objConn = Nothing
> Response.Write("<A HREF=index.aspx'>")
> Response.Write("Sorry, looks like your session timed out, please login
again.")
> Response.Write("</A>")
> Response.End()
> End If
> bolAlreadyExists = False
> Dim objDataReader as OledbDataReader
> Dim objCommand as New OledbCommand("Select * From Results", objConn)
> objDataReader = objCommand.ExecuteReader()
> Do While Not (objDataReader.Read()= False OR bolAlreadyExists)
> If (StrComp(objDataReader("Email"), Request.Form("Email"), vbTextCompare)
= 0) Then
> Response.Redirect("record_exists.aspx")
> bolAlreadyExists = True
> End If
> Loop
> objDataReader.Close()
> If Not bolAlreadyExists Then
> Dim Email, passwd, first_name, last_name, company, street_address,
address2, city, prov, country, postal, phone, mobilePhone, AddDate,Investor,
RemoteIP
> Email = Request.Form("Email")
> passwd = Request.Form("password")
> first_name = Request.Form("first_name")
> last_name = Request.Form("last_name")
> company = Request.Form("company")
> street_address = Request.Form("street_address")
> address2 = Request.Form("address2")
> city = Request.Form("city")
> prov = Request.Form("state")
> country = Request.Form("country")
> postal = Request.Form("postal")
> phone = Request.Form("phone")
> mobilePhone = Request.Form("mobile")
> AddDate = Now
> Inv = "Yes"
> RemoteIP = Request.ServerVariables("REMOTE_ADDR")
> Dim MySQL as String
> MySQL = "INSERT INTO Results(email, password, first_name, last_name,
company, street_address, address2, city, state, country, postal, phone,
mobile, AddDate, Inv, RemoteIP)" & _
> " VALUES('" & Email & "', '" & passwd & "', '" & first_name & "', '" &
last_name & "', '" & company & "', '" & street_address & "', '" & address2 &
"', '" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '"
& phone & "', '" & mobilePhone & "', '" & AddDate & "', '" & Investor & "',
'" & RemoteIP & "')"
> Dim cmd as New OleDBCommand (MySQL, objConn)
> cmd.ExecuteNonQuery ()
> End if
> objConn = Nothing
> objConn.Close()
> %>
>

Friday, March 16, 2012

Please help me with configuration

Hi,
I can not sort out error message "conflict with another Web Server on the same port". I read an older discussion "new to server" about this problem. I followed all steps but it did not help.
Can someone help me please?This happens if something else is communicating on port 80. If you have another application that is acting as a web server then it needs to be reconfigured, or you need to reconfigure IIS to operate on a different port. One example of why this error might occur is that Skype operates on port 80 so that it can operate through firewalls - however it can be reconfigured.

Hi,
thanks for your reply. I used netstat -a in comand line.The port 80 is not use by any application. I don′t have IIS installed. I read all articles in this forum about the conflict.I have been trying it to set up more then 5 hours.


Hi,

Let me add my two cents. If you are working on linux to see which application is already using port 80 use:
fuser -n tcp 80
or for windows try:
netstat -v
see if you find some other application using port 80. End that process and try to run your website again.
Abhishek


Thank for the help,
I use win XP profesional SP2. I entered netstat -y and found no application used port 80.
Cheers
I am not sure about your case but some of the times a firewall too blocks access to default HTTP port 80. so try to disable your xp firewall and other such utility and install your web server once again.

Please help on this ERROR

Can someone tell me what should I do whith this error message

'C:\Inetpub\wwwroot\ABC\ABC.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.We need a little more info on how you are trying to access the file?

Code behind? And maybe a code snipet?

Thanks,

Zath
The file isn't there or the application doesn't have permissions to open the file.
yes I try to access the file by code behide
I think one thread on this subject was enough.