|
Thank you for your help!
I will try it.
|
|
|
|
|
I have the following code in an asp file that receives data from a form. I can not get the if statement to work correctly. The if statement should check if the user name is in the database field "name" and if true then do not submit the information and if not true run the insert function. Any help would be appreciated.
<%
' Declaring variables
Dim data_source, con, sql_select, sql_insert
' Receiving values from Form
name =(Request.Form("name"))
email =(Request.Form("email"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("db.mdb")
sql_insert = "insert into tblAnswers (name, email) values values ('" & name & "', '" & email & "')
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
'Checking if user has taken survey
'sql_select = "SELECT * FROM tblAnswers"
if name = (Request.Form("name")) then
'Response.Write("You have already taken the survey")
'Else
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Response.Write("Thank you for taking the survey")
'End If
%>
Thomas
-- modified at 12:40 Wednesday 30th November, 2005
|
|
|
|
|
That is because you are not getting any data from the database. You are just comparing the value from the form with itself, that will of course always give you the result True.
---
b { font-weight: normal; }
|
|
|
|
|
I know that there is a special forum for such things. However, I think that the post suits better here.
It passed a long time since I've programmed something, which was cool, ect. ( in programming terms ). I don't have any idea and motivation. Because of that I decided to write an article.
Some time ago (long time ago) I wrote this piece of code: HtmlEditor[^]. A Asp.Net based HtmlEditor server control.
Is anybody interested in reading an article about it?
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
There's an error in your page.
I got an "Object reference not set to an instance of an object." error when accessing the site[^]
Edbert P.
Sydney, Australia
|
|
|
|
|
I would find the article interesting. I was looking at this kind of thing about 1.5 years ago, but with no time, I bought third party. I am especially interested in cross-browser support aspects, even though you haven't finished that part completely. What were the most difficult cross-browser compromises...stuff like that.
|
|
|
|
|
Your help is very appreciated.
I need to invoke browser and open the reference by (for exapmple) pressing the button in WIN32 aplication.
How I can do it?
|
|
|
|
|
Version of Microsoft WebControls is 1.0.2.226.
During page load(aspx page), I would like to select a node based on the key passed in the querystring. I could not find any code related to that. Help needed
Thanks in advance
|
|
|
|
|
Hi everyone..
I'm currently doing a web application using C# which i'm unfamiliar with the prgram. I need urgent help~ My problem is that if i retrieve the database, how can i select, edit or delete the particulars from the database which i select? Anyone who know how to code it?? I have tried several times and it seem like is not right.. Your help is greatly appreciated.. Thankz.. =)
Cheers!
|
|
|
|
|
Please don't double post.
---
b { font-weight: normal; }
|
|
|
|
|
Good morning
Write a method like the below to populate the form
// could be global
private string strErrorMsg = "Database error: " + exp.Message;
try
{
SqlConnection conn = new SqlConnection(put your connection string hear);
strSQL = "SELECT * FROM theNameOftheTable";
SqlCommand cmd = new SqlCommand(strSQL, conn);
cmd.CommandType = CommandType.Text;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
// a method to display the information, is this a grid or form with textboxes?
conn.Close();
cmd.Dispose();
conn.Dispose();
}
catch
{
//some message about the error
strErrorMsg;
}
|
|
|
|
|
How do you add/save a row using the INSERT sql command in a web form with textbox not a datagrid? Below is my code, what wroung and why does fall through to the "finally block?"
private void SaveRecord()
{
string strSQL;
if(btnSave.CommandArgument == "Add")
{
strSQL =
"INSERT INTO CoinCollection " +
" (ID, TypeOfCoin, YearOfCoin, StateOfCoin, DateReceive)" +
"VALUES " +
" (@ID, @TypeOfCoin, @YearOfCoin, @StateOfCoin, @DateReceive)";
}
else
{
// The user is updating an existing item
strSQL =
"UPDATE CoinCollection " +
" SET TypeOfCoin = @TypeOfCoin, " +
" YearOfCoin = @YearOfCoin, " +
" StateOfCoin = @StateOfCoin, " +
" DateReceive = @DateReceive " +
"WHERE ID = @ID";
}
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["connString"]);
SqlCommand cmSQL = new SqlCommand(strSQL, conn);
// Add all the requuired SQL Parmeters.
cmSQL.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int)).Value = Convert.ToInt32(tbID.Text);
cmSQL.Parameters.Add(new SqlParameter("@TypeOfCoin", SqlDbType.VarChar, 50)).Value = tbToc.Text;
cmSQL.Parameters.Add(new SqlParameter("@YearOfCoin", SqlDbType.VarChar, 50)).Value = tbYoc.Text;
cmSQL.Parameters.Add(new SqlParameter("@StateOfCoin", SqlDbType.VarChar, 50)).Value = tbSoc.Text;
cmSQL.Parameters.Add(new SqlParameter("@DateReceive", SqlDbType.VarChar, 50)).Value = tbDr.Text;
try
{
conn.Open();
cmSQL.ExecuteNonQuery();
strMsg = "Coin successfully saved to the database.";
}
catch(Exception exp)
{
strErrorMsg = "Database error! Coins not saved to database. Error Message: " + exp.Message;
}
finally
{
conn.Close();
btnAdd.Enabled = true;
}
}
|
|
|
|
|
Hi there,
Can u post the error exception message?
<< >>
|
|
|
|
|
Good morning and thanks for looking at this for me. The answer to your question is "no" the program drops through the exceptions to the finally block and executes the code to enable the Add button.
Brent
|
|
|
|
|
I did'nt try....
|
|
|
|
|
hi,
i need to access different servers providing same web service interface. when i want to access them i need to create two different web references.
when i access each of them i create instance of the webservice link and invoke a method.
i need to parse the 'return' object that i get it when i invoke a web service. the problem is i need to parse it separately the returns from two different webservices because of classCast problem.
most probably i am doing something wrong. how do i update my code so that i have common parsing and invocation methods for both of these services with same web service interface.
regards,
rnv
|
|
|
|
|
Hi there,
We have a web application written in asp.net (1.1). Without going
into too much detail, we use a DLL to communicate with the database and
also a couple of webservices. When we deployed version 1, everything
deployed OK on our webserver. We deployed the application and 1 webservice
under default web site, the other webservice (3rd party supplied) is on
another server and services many other application in our organisation
sucessfully.
Recently we have tried to deploy version 2, but this time we have assigned
another IP address to the web server and tried to install the application
under a new website. Everything looked OK the application installed OK and
most of the functionallity works just fine but 1 or 2 of the webservice calls
fails with the error:
"Index was outside the bounds of the array"
I get this error on both webservices, on specific webmethods, but it DOES
work OK on default website....
Any help on this would be appreciated
Cammie
|
|
|
|
|
The error message is not at all specific for web services. The error is plainly as the message says; somewhere there is an array, and an attempt is made to access an item at an index that is outside the bounds of the array.
Does the error message come from the code calling the wbe service, or does the error message come from the code executed in the web service?
---
b { font-weight: normal; }
|
|
|
|
|
Hi there,
Thanks for your interest.
It looks like the web service returns no data and the calling code is falling over when populating a grid. As I have stated earlier, the code runs fine from 'default' website.
Cammie
|
|
|
|
|
This question is related to java program if any budy knows it please give me answer bcz i am new to the java technology sir. The problem is
i am using 3 methos
<br />
public void setDay(String s)<br />
{<br />
day = s;<br />
}<br />
<br />
public String getDay()<br />
{<br />
return day;<br />
}<br />
<br />
public void setMonth(String s)<br />
{<br />
month = s;<br />
}<br />
<br />
public String getMonth()<br />
{<br />
return month;<br />
}<br />
<br />
public void setYear(String s)<br />
{<br />
year = s;<br />
}<br />
<br />
public String getYear()<br />
{<br />
return year;<br />
}<br />
<br />
public Date getCust_dob()<br />
{<br />
cust_dob = valueOf(year + "-" + month + "-" + day);<br />
return cust_dob;<br />
}<br />
when i was trying to compile the program i am getting an error:
cannot find symbol valueOf(String)
if any budy knows about this kindly response me..
|
|
|
|
|
You have to specify for what class you want to call the ValueOf method.
cust_dob = Date.valueOf(year + "-" + month + "-" + day);
---
b { font-weight: normal; }
|
|
|
|
|
How to capture the Click event of radio button list in Datagrid?
|
|
|
|
|
I cannot find winhttp.h and winhttp5.lib files on my computer. Where I can get it?
At least, can anybody be so kind to send these me via e-mail: dubovoy@host.kr.ua
Thanks a lot.
|
|
|
|
|
When a user clicks on a download button, it should popup an window asking for the type of file(it may contain dropdown list with list of values populated from a database). Based on the selection, the corresponding file format to be downloaded. How to incorporate the same in ASP.Net and how to invoke a message box like a normal application and also how to capture the command button clicked on the dialog box?
Thanks in advance
|
|
|
|
|
As the dialog should be displayed on the client side, you can't use ASP.NET to do it. The ASP.NET code is run on the server, using a dialog box would display it on the server, not on the client.
You have to use javascript to open a window with a page that let's the user do the selection.
---
b { font-weight: normal; }
|
|
|
|