Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Thursday, March 29, 2012

Please advise on how to create an invoice system

i'm trying to create an asp webform for my own development. I'm trying to create an online invoice where people can enter details like "Customer Name, Address, Date, Total amount".

I'm able to create a webform which captures those details and insert/delete/delete to/from a mssql db.

But because each invoice should have some items, so i created another table (InvoiceDetails) which reference to the Invoice table. So i can create as many items as i want in each invoice.

How should i create webforms for the invoicedetails? Because i need to add dynamically and not fix 10 records to add/edit in the form. THus most probably i'll need to put all sql statements into 1 transaction in case 1 InvoiceDetail record fail, so i can rollback the Invoice and InvoiceDetail record.

are there any samples which has a similar scenario as me?Its an interesting scenario Michael, especially the cardinality of relationship & dynamic nature of this application. If formatting doesn't matter much at data-entry level, you can use editable datagrid to insert/edit/delete data. This will totally accomodate the dynamic nature of InvoiceDetails using this strong data-aware component in ASP.NET. However, for printing & display in invoice report format, you may need to postion the dynamic controls on the fly which may get difficult if positions need customized.

MSDN's article "Adding Controls to a Web Forms Page Programmatically" may help.
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskaddingcontrolstowebformspageprogrammatically.asp?frame=true

I hope it helps.

-Adnan Masood
This is a job for a new application model. HTML sucks for this stuff. Imagine writing an ERP application for the Web.. Wait Oracle did it.. sort of.

You will probably want to employ some thrd party web controls from the folks at Infragistics. Adding detail lines to invoices without them will be a little kludgy.

I did it once and ended up doing it with a series of frames. A button on the header page took you to a detail page. After adding the data on the detail page you went back to the header. It was a lot of tedious work.
Hmm, I would have a form that adds a single item to the order. Then two buttons, one says "Add another item" and one says "Finish Order". Add another item just reloads the form and Finish Order goes to whatever the next step is.

For editing just use a datalist that binds to the order number.

I do a similar type system for magazine advertising rates for each year. A particular magazine can have 10 years worth of prices and each year can have 20 different rates (for various sizes). The datalist shows all 10 years (queried by the magazine ID) and when they select the edit button it changes all the prices into textboxes for that year only. So your datalist would show all items for a single order, and then allow editing of each individual item inside that order.
hmm... datalist.. but what if its a new invoice? Thus it will not be given a Invoice ID until its inserted into the database. So its kinda hard to bind the individual items to that invoice

thats why i'm asking for advise on whats the best practise for people who has done similar development..
While you are entering the invoice keep the database in some temp tables. Identify the record with a GUID.. after you are done editing copy that data from the temp tables into the production tables. This works well and requires no whacky state management. It depends on the level of sophistication you want. In my current business we don;t start out by entering an order/invoice. We enter contracts the contracts get attached to jobs and several people may be involved with entering the data about the contracts and jobs. As the work on the contract proceeds incremental invoices are issued.

Monday, March 26, 2012

please help

I have installed "MIcrosoft Visual studio.net 2003" on XP
platform,used it for a month but now I'm facing the
following problems:
1. my system shuts down whem i m using MSDN or any other .net framework
utilities like .net command prompt etc.

2. The folder option(hide/view hidden files) in the TOOLS option has
also dissapeared.

3. The IIS server has stopped,and can't be restarted.

this common problem is also being faced by some of my friends, so
please any s/w specialist please help me to solve this problem.

please mail me at: ravinder_rawat1985@dotnet.itags.org.yahoo.co.in
ravinderrawat85@dotnet.itags.org.gmail.comTry to write a more descriptive subject.

Don't expect replies to be sent to your mailbox. The newsgroup is a
place for discussion, not a notice board.

It sounds more like a virus than a problem with Visual Studio,
especially as it seems to be spreading among your friends. Do you have
any virus protection?

ravinderrawat85@.gmail.com wrote:

Quote:

Originally Posted by

I have installed "MIcrosoft Visual studio.net 2003" on XP
platform,used it for a month but now I'm facing the
following problems:
1. my system shuts down whem i m using MSDN or any other .net framework
utilities like .net command prompt etc.
>
2. The folder option(hide/view hidden files) in the TOOLS option has
also dissapeared.
>
3. The IIS server has stopped,and can't be restarted.
>
this common problem is also being faced by some of my friends, so
please any s/w specialist please help me to solve this problem.
>
please mail me at: ravinder_rawat1985@.yahoo.co.in
ravinderrawat85@.gmail.com
>

please help

I have installed "MIcrosoft Visual studio.net 2003" on XP
platform,used it for a month but now I'm facing the
following problems:
1. my system shuts down whem i m using MSDN or any other .net framework
utilities like .net command prompt etc.
2. The folder option(hide/view hidden files) in the TOOLS option has
also dissapeared.
3. The IIS server has stopped,and can't be restarted.
this common problem is also being faced by some of my friends, so
please any s/w specialist please help me to solve this problem.
please mail me at: ravinder_rawat1985@dotnet.itags.org.yahoo.co.in
ravinderrawat85@dotnet.itags.org.gmail.comTry to write a more descriptive subject.
Don't expect replies to be sent to your mailbox. The newsgroup is a
place for discussion, not a notice board.
It sounds more like a virus than a problem with Visual Studio,
especially as it seems to be spreading among your friends. Do you have
any virus protection?
ravinderrawat85@.gmail.com wrote:
> I have installed "MIcrosoft Visual studio.net 2003" on XP
> platform,used it for a month but now I'm facing the
> following problems:
> 1. my system shuts down whem i m using MSDN or any other .net framework
> utilities like .net command prompt etc.
> 2. The folder option(hide/view hidden files) in the TOOLS option has
> also dissapeared.
> 3. The IIS server has stopped,and can't be restarted.
> this common problem is also being faced by some of my friends, so
> please any s/w specialist please help me to solve this problem.
> please mail me at: ravinder_rawat1985@.yahoo.co.in
> ravinderrawat85@.gmail.com
>

Please help - Passing credentials to windows integrated authentication

I try to access an asp page in a machine that has windows integrated
authentication turned on.
I use System.Net.Networkcredentials as well as System.Net.Webrequest and
Webresponse.
I receive a response but when I try to use Response.Redirect(), a popup
windows appears asking me for user, password, domain.
Is there a way to pass the credentials to the Reponse.Redirect function so I
do not get prompted for credentials again?
This is the code i use:
Dim objCredentials As New System.Net.NetworkCredential
(strUsername, strPassword, strDomain)
Dim objCache As New System.Net.CredentialCache
objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
Dim objWebRequest As System.Net.WebRequest
Dim objWebResponse As System.Net.WebResponse
try
objWebRequest = System.Net.WebRequest.Create(strURL)
objWebRequest.Credentials = objCache
objWebResponse = objWebRequest.GetResponse()
'I get prompted here
Response.Redirect(strURL, False)
Response.Close()
catch ex as exception
end try
Thank you very muchNo there is not. When you use the WebRequest object on the server, the
server is making the request, passing the network credentials. When you use
Response.Redirect, you are instructing the remote client, to make another
request to the server address you passed it, strURL.
The remote user then makes the request to strURL; the browser will only send
the credentials on the machine the remote user is using. I know of no
workaround.
HTH,
bill
"jadher" <jadher@.excite.com> wrote in message
news:uZVSAz5rEHA.1152@.TK2MSFTNGP11.phx.gbl...
> I try to access an asp page in a machine that has windows integrated
> authentication turned on.
> I use System.Net.Networkcredentials as well as System.Net.Webrequest and
> Webresponse.
> I receive a response but when I try to use Response.Redirect(), a popup
> windows appears asking me for user, password, domain.
> Is there a way to pass the credentials to the Reponse.Redirect function so
I
> do not get prompted for credentials again?
> This is the code i use:
> Dim objCredentials As New System.Net.NetworkCredential
> (strUsername, strPassword, strDomain)
> Dim objCache As New System.Net.CredentialCache
> objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
> Dim objWebRequest As System.Net.WebRequest
> Dim objWebResponse As System.Net.WebResponse
> try
> objWebRequest = System.Net.WebRequest.Create(strURL)
> objWebRequest.Credentials = objCache
> objWebResponse = objWebRequest.GetResponse()
> 'I get prompted here
> Response.Redirect(strURL, False)
> Response.Close()
> catch ex as exception
> end try
> Thank you very much
>

Please help - Passing credentials to windows integrated authentication

I try to access an asp page in a machine that has windows integrated
authentication turned on.

I use System.Net.Networkcredentials as well as System.Net.Webrequest and
Webresponse.

I receive a response but when I try to use Response.Redirect(), a popup
windows appears asking me for user, password, domain.

Is there a way to pass the credentials to the Reponse.Redirect function so I
do not get prompted for credentials again?

This is the code i use:
Dim objCredentials As New System.Net.NetworkCredential
(strUsername, strPassword, strDomain)
Dim objCache As New System.Net.CredentialCache
objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
Dim objWebRequest As System.Net.WebRequest
Dim objWebResponse As System.Net.WebResponse
try
objWebRequest = System.Net.WebRequest.Create(strURL)
objWebRequest.Credentials = objCache
objWebResponse = objWebRequest.GetResponse()

'I get prompted here
Response.Redirect(strURL, False)
Response.Close()
catch ex as exception
end try

Thank you very muchNo there is not. When you use the WebRequest object on the server, the
server is making the request, passing the network credentials. When you use
Response.Redirect, you are instructing the remote client, to make another
request to the server address you passed it, strURL.

The remote user then makes the request to strURL; the browser will only send
the credentials on the machine the remote user is using. I know of no
workaround.

HTH,

bill

"jadher" <jadher@.excite.com> wrote in message
news:uZVSAz5rEHA.1152@.TK2MSFTNGP11.phx.gbl...
> I try to access an asp page in a machine that has windows integrated
> authentication turned on.
> I use System.Net.Networkcredentials as well as System.Net.Webrequest and
> Webresponse.
> I receive a response but when I try to use Response.Redirect(), a popup
> windows appears asking me for user, password, domain.
> Is there a way to pass the credentials to the Reponse.Redirect function so
I
> do not get prompted for credentials again?
> This is the code i use:
> Dim objCredentials As New System.Net.NetworkCredential
> (strUsername, strPassword, strDomain)
> Dim objCache As New System.Net.CredentialCache
> objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
> Dim objWebRequest As System.Net.WebRequest
> Dim objWebResponse As System.Net.WebResponse
> try
> objWebRequest = System.Net.WebRequest.Create(strURL)
> objWebRequest.Credentials = objCache
> objWebResponse = objWebRequest.GetResponse()
> 'I get prompted here
> Response.Redirect(strURL, False)
> Response.Close()
> catch ex as exception
> end try
> Thank you very much

Please help - weird problem

Hi,
While trying to create new directory i recieve the following error
message:
"System.IO.DirectoryNotFoundException: Could not find a part of the path
"\\premfs16\sites".
The path exists, even when i check the path
with the code: Directory.Exists(...) the result is true.

Here is the code:
http://www.adeo.co.il/test.aspx

Notice that in the line before the code throws exception
i create new file to the same path and no error
occurs - only when trying to create directory
the error appears.

Any idea?Yoni,

This is a security problem. You need to grant read permission for
\\premfs16\sites to the ASP.NET user.

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> Hi,
> While trying to create new directory i recieve the following error
> message:
> "System.IO.DirectoryNotFoundException: Could not find a part of the path
> "\\premfs16\sites".
> The path exists, even when i check the path
> with the code: Directory.Exists(...) the result is true.
> Here is the code:
> http://www.adeo.co.il/test.aspx
> Notice that in the line before the code throws exception
> i create new file to the same path and no error
> occurs - only when trying to create directory
> the error appears.
> Any idea?
So how do you explain that the code succeeded creating
a file (which needs to read the same path...) and only
creating a directory failed?

"Eliyahu Goldin" wrote:

> Yoni,
> This is a security problem. You need to grant read permission for
> \\premfs16\sites to the ASP.NET user.
> Eliyahu
> "?? ???" <@.discussions.microsoft.com> wrote in message
> news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > Hi,
> > While trying to create new directory i recieve the following error
> > message:
> > "System.IO.DirectoryNotFoundException: Could not find a part of the path
> > "\\premfs16\sites".
> > The path exists, even when i check the path
> > with the code: Directory.Exists(...) the result is true.
> > Here is the code:
> > http://www.adeo.co.il/test.aspx
> > Notice that in the line before the code throws exception
> > i create new file to the same path and no error
> > occurs - only when trying to create directory
> > the error appears.
> > Any idea?
>
Yoni,

Probably file creating doesn't require read permission but directory
creating does. I don't know exactly how all these permissions work.

Security and permission setting is a complicated matter. You don't really
need to understand fully the theoretical background. For your immediate
problem it's enough to know how other people solved the same problem. If you
wish to investigate - you are welcome to invest your time in that.

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> So how do you explain that the code succeeded creating
> a file (which needs to read the same path...) and only
> creating a directory failed?
> "Eliyahu Goldin" wrote:
> > Yoni,
> > This is a security problem. You need to grant read permission for
> > \\premfs16\sites to the ASP.NET user.
> > Eliyahu
> > "?? ???" <@.discussions.microsoft.com> wrote in message
> > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > Hi,
> > > While trying to create new directory i recieve the following error
> > > message:
> > > "System.IO.DirectoryNotFoundException: Could not find a part of the
path
> > > "\\premfs16\sites".
> > > The path exists, even when i check the path
> > > with the code: Directory.Exists(...) the result is true.
> > > > Here is the code:
> > > http://www.adeo.co.il/test.aspx
> > > > Notice that in the line before the code throws exception
> > > i create new file to the same path and no error
> > > occurs - only when trying to create directory
> > > the error appears.
> > > > Any idea?
>
The problem is much more sophisticated.
My web site host at shared hosting company.
No hosting company will allow users to have read
permissions on their root directory.
So what you are actually saying is that you can not
open directories on web sites which hosts on shared servers.
Is that correct?

"Eliyahu Goldin" wrote:

> Yoni,
> Probably file creating doesn't require read permission but directory
> creating does. I don't know exactly how all these permissions work.
> Security and permission setting is a complicated matter. You don't really
> need to understand fully the theoretical background. For your immediate
> problem it's enough to know how other people solved the same problem. If you
> wish to investigate - you are welcome to invest your time in that.
> Eliyahu
> "?? ???" <@.discussions.microsoft.com> wrote in message
> news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> > So how do you explain that the code succeeded creating
> > a file (which needs to read the same path...) and only
> > creating a directory failed?
> > "Eliyahu Goldin" wrote:
> > > Yoni,
> > > > This is a security problem. You need to grant read permission for
> > > \\premfs16\sites to the ASP.NET user.
> > > > Eliyahu
> > > > "?? ???" <@.discussions.microsoft.com> wrote in message
> > > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > > Hi,
> > > > While trying to create new directory i recieve the following error
> > > > message:
> > > > "System.IO.DirectoryNotFoundException: Could not find a part of the
> path
> > > > "\\premfs16\sites".
> > > > The path exists, even when i check the path
> > > > with the code: Directory.Exists(...) the result is true.
> > > > > > Here is the code:
> > > > http://www.adeo.co.il/test.aspx
> > > > > > Notice that in the line before the code throws exception
> > > > i create new file to the same path and no error
> > > > occurs - only when trying to create directory
> > > > the error appears.
> > > > > > Any idea?
> > > > > >
Well, I don't think you need read permissions for the root directory, only
for those under yours. Speak to your host and ask again on security
newsgroups.

Good luck,

Eliyahu

"?? ???" <@.discussions.microsoft.com> wrote in message
news:064E4D9D-5536-4DFD-A83D-6B9957ED5BFE@.microsoft.com...
> The problem is much more sophisticated.
> My web site host at shared hosting company.
> No hosting company will allow users to have read
> permissions on their root directory.
> So what you are actually saying is that you can not
> open directories on web sites which hosts on shared servers.
> Is that correct?
> "Eliyahu Goldin" wrote:
> > Yoni,
> > Probably file creating doesn't require read permission but directory
> > creating does. I don't know exactly how all these permissions work.
> > Security and permission setting is a complicated matter. You don't
really
> > need to understand fully the theoretical background. For your immediate
> > problem it's enough to know how other people solved the same problem. If
you
> > wish to investigate - you are welcome to invest your time in that.
> > Eliyahu
> > "?? ???" <@.discussions.microsoft.com> wrote in message
> > news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> > > So how do you explain that the code succeeded creating
> > > a file (which needs to read the same path...) and only
> > > creating a directory failed?
> > > > "Eliyahu Goldin" wrote:
> > > > > Yoni,
> > > > > > This is a security problem. You need to grant read permission for
> > > > \\premfs16\sites to the ASP.NET user.
> > > > > > Eliyahu
> > > > > > "?? ???" <@.discussions.microsoft.com> wrote in message
> > > > news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> > > > > Hi,
> > > > > While trying to create new directory i recieve the following error
> > > > > message:
> > > > > "System.IO.DirectoryNotFoundException: Could not find a part of
the
> > path
> > > > > "\\premfs16\sites".
> > > > > The path exists, even when i check the path
> > > > > with the code: Directory.Exists(...) the result is true.
> > > > > > > > Here is the code:
> > > > > http://www.adeo.co.il/test.aspx
> > > > > > > > Notice that in the line before the code throws exception
> > > > > i create new file to the same path and no error
> > > > > occurs - only when trying to create directory
> > > > > the error appears.
> > > > > > > > Any idea?
> > > > > > > > >

Please help - weird problem

Hi,
While trying to create new directory i recieve the following error
message:
"System.IO.DirectoryNotFoundException: Could not find a part of the path
"\\premfs16\sites".
The path exists, even when i check the path
with the code: Directory.Exists(...) the result is true.
Here is the code:
http://www.adeo.co.il/test.aspx
Notice that in the line before the code throws exception
i create new file to the same path and no error
occurs - only when trying to create directory
the error appears.
Any idea?Yoni,
This is a security problem. You need to grant read permission for
\\premfs16\sites to the ASP.NET user.
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
> Hi,
> While trying to create new directory i recieve the following error
> message:
> "System.IO.DirectoryNotFoundException: Could not find a part of the path
> "\\premfs16\sites".
> The path exists, even when i check the path
> with the code: Directory.Exists(...) the result is true.
> Here is the code:
> http://www.adeo.co.il/test.aspx
> Notice that in the line before the code throws exception
> i create new file to the same path and no error
> occurs - only when trying to create directory
> the error appears.
> Any idea?
>
So how do you explain that the code succeeded creating
a file (which needs to read the same path...) and only
creating a directory failed?
"Eliyahu Goldin" wrote:

> Yoni,
> This is a security problem. You need to grant read permission for
> \\premfs16\sites to the ASP.NET user.
> Eliyahu
> "' '?" <@.discussions.microsoft.com> wrote in message
> news:B997041C-220A-4ADC-9528-65BC289CED2F@.microsoft.com...
>
>
Yoni,
Probably file creating doesn't require read permission but directory
creating does. I don't know exactly how all these permissions work.
Security and permission setting is a complicated matter. You don't really
need to understand fully the theoretical background. For your immediate
problem it's enough to know how other people solved the same problem. If you
wish to investigate - you are welcome to invest your time in that.
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> So how do you explain that the code succeeded creating
> a file (which needs to read the same path...) and only
> creating a directory failed?
> "Eliyahu Goldin" wrote:
>
path
The problem is much more sophisticated.
My web site host at shared hosting company.
No hosting company will allow users to have read
permissions on their root directory.
So what you are actually saying is that you can not
open directories on web sites which hosts on shared servers.
Is that correct?
"Eliyahu Goldin" wrote:

> Yoni,
> Probably file creating doesn't require read permission but directory
> creating does. I don't know exactly how all these permissions work.
> Security and permission setting is a complicated matter. You don't really
> need to understand fully the theoretical background. For your immediate
> problem it's enough to know how other people solved the same problem. If y
ou
> wish to investigate - you are welcome to invest your time in that.
> Eliyahu
> "' '?" <@.discussions.microsoft.com> wrote in message
> news:6EA67417-C3C4-4B5E-9084-DDC2EBB3DC76@.microsoft.com...
> path
>
>
Well, I don't think you need read permissions for the root directory, only
for those under yours. Speak to your host and ask again on security
newsgroups.
Good luck,
Eliyahu
"' '?" <@.discussions.microsoft.com> wrote in message
news:064E4D9D-5536-4DFD-A83D-6B9957ED5BFE@.microsoft.com...
> The problem is much more sophisticated.
> My web site host at shared hosting company.
> No hosting company will allow users to have read
> permissions on their root directory.
> So what you are actually saying is that you can not
> open directories on web sites which hosts on shared servers.
> Is that correct?
> "Eliyahu Goldin" wrote:
>
really
you
the

Saturday, March 24, 2012

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()
> %>
>

Wednesday, March 21, 2012

Please help me ..(:

Hi,

When user clicks on the PRINT button, i like the system automatically print a WEBFORM ASPX file (which is in Report format)..ie, OnClick it should call that ASPX file and print it...

Please advice me (:You have to make a "Printer Friendly Version" button that the user can click to go to that page (or load a pop up) and then call window.print(); (I think).
You can also create a style in your stylesheet that will resize the controls differently for "print" and "screen" situations. This will allow you to auto-resize all pages so they
are printer-friendly.
Hello -

I'm assuming you have something like an array (list) of documents that
you would like to choose from to print...

I had the same type of task...

I completed it with having a button for each entry on the form, and when
the user pressed a button, a child window (popup) would display the
form (or PDF)
The popup window had a header frame that allowed the user to print or
cancel the form...

the trick was, once the popup window ready to be displayed, i would create
a DIV tag around the entire contents, and the print button would print the
contents of the DIV tag...

I also added a little model window magic - to keep the child window
open until the user closes the popup.

Worked like a champ.

best of luck

take care
tony
Hi,

it's a much cleaner solution to use css for this one. Take a look at this article:CSS Design: Going to Print.

Grz, Kris.

please help me soon!

Hi,i upload my aspx files in server that support asp when I try to run pages it dosent show any thing in my system and it shows error about <authentication mode="windows" /> so I set it t
<authentication mode="none" /><!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny acces
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users
--><forms name=".ASPXAUTH
loginUrl="orderdetails.aspx
protection="Validation
timeout="999999" /><authorization

this is a page I want to run . if i new virtual directory in server all the pages are in asp and run and just i have 2 page in .net that want to run in this project does it need have two virtual directory one for asp.net pages and another for asp pages and does it couse problem

If some body can help meFirst what sort of error do you get and second, no you do not need to virtual web servers.
hi this is an error
this is an error to use a section register as allow definition='machine to application' beyond application level.yhis error can be coused by a virtual directory not being configured as an application in iis

Friday, March 16, 2012

please help me to clear this error

hi, i am working in c# asp.net.

my cs:

public void confirm(Object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item//e.Item.ItemType ==ListItemType.AlternatingItem)
{
LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";
}

}
i am using this coding to show confirm button while clicking the delete button.
this is my aspx:
<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 56px"
runat="server" OnDeleteCommand="cmddelete" DataKeyField="age" OnUpdateCommand="cmdupdate"
OnEditCommand="cmdedit" OnItemDataBound ="confirm" OnCancelCommand="cmdcancel" AutoGenerateColumns="False" OnItemCommand="insert"
ShowFooter="True" HeaderStyle-BackColor="#660033" HeaderStyle-ForeColor="white" BackColor="#660033"
ForeColor="#ffffff">

i did for edit,insert,delete allthe things correctly and works well, then i added this confirm delete, for this confirm i am getting the following error:

Compiler Error Message: CS0123: Method 'sqlserver.WebForm4.confirm(object, System.Web.UI.WebControls.DataGridCommandEventArgs)' does not match delegate 'void System.Web.UI.WebControls.DataGridItemEventHandler(object, System.Web.UI.WebControls.DataGridItemEventArgs)'

so please help me to solve this error,pleaseeeeeeeeeeeeeeeeTry Changing
public void confirm(Object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
To
public void confirm(Object source,System.Web.UI.WebControls.DataGridItemEventArgs e)
hi ferris, thanks for reply and i did modification as what u said, i am getting error in this,

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

public void confirm(Object source,System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType ==ListItemType.Item||e.Item.ItemType ==ListItemType.AlternatingItem)
{
//LinkButton btn=((LinkButton)e.Item.FindControl("delete"));
//btn.Attributes.Add("onclick","return confirm('Are you sure you want to delete this company?');");
LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";
//b.Attributes.Add("onclick","return confirm('Are you sure you want to delete this company?');");
}
}

please help me to rectify this error.
Hi,

Try changing

LinkButton lb=(LinkButton)e.Item.Cells[0].FindControl("btndelete");
lb.Attributes["onclick"]="return(confirm('Confermi?'))";

To

LinkButton lb = (LinkButton)e.Item.FindControl("btnDelete");
lb.Attributes.Add("onclick", "return(confirm('Confermi?'));

hth