hericles 289 Master Poster Featured Poster

So what line gives the error? You could narrow down the search for us a bit:)

hericles 289 Master Poster Featured Poster

I'm guessing it is here:
"SELECT * FROM Reg WHERE userid = 'u_name' AND password = 'pwd' "

You aren't inserting the values of u_name and pwd here, you are inserting the text strings u_name and pwd.
You need this:

"SELECT * FROM Reg WHERE userid = '" & u_name & "' AND password = '" & pwd & "' "

Hope that helps,

hericles 289 Master Poster Featured Poster

A better solution than saving the actual image itself in the database is to store the location of the image (its URL or file system location). Obviously to do that you need to have the column in the table set to accept varchar() and then just insert the URI of the image into (e.g C:\images\pic1.jpg or whatever it happens to be).
You can save the image itself if you want to waste the space by using the blob object

hericles 289 Master Poster Featured Poster

If you want a quick and dirty solution, break your input into a character array and loop through it. For each character check if it isDigit(), if yes no change is required. Then check for the special characters you need to remove. Lastly check isUpper for the character. If false use toUpper, if true use toLower to convert them.
In some simple but ugly pseudo code:

if(isDigit){
   add to output string
} else if(isSpecial) {
  do not add to output string
} else if(isUpper) {
  character.toLower()
  add to output string
} else {
  character.toUpper()
  add to output string
}
hericles 289 Master Poster Featured Poster

Depends how you want to store the zip codes and states. If you intend to track down and store the list yourself you will probably want to place it in a database. However, there are web services out there you could query with the zip code and get back the state.
If the zip codes are all the same length (5 charaters like the one above) you can include code to check when the zip code text == 5 and then call the code to access the database or web service. You will want to AJAX it too, I personally hate web pages that auto reload because of some obscure action I have done.

hericles 289 Master Poster Featured Poster

Select MAX(transac_num) FROM tblborrow will get you the highest value currently stored in that column so you might want to get that and display it in your label.
I'm not sure if Access has the @@identity function the same as some other sql databases do.
You would need to get the max value of the column each time a user saves data to avoid concurrency issues involved with two people using the software at the same time (rather than automatically increment the label value in your code).
To know if the fields have been populated use required field validators or do some custom code yourself to check the textboxes aren't empty.
Hope that helps,

hericles 289 Master Poster Featured Poster

Are you actually using transactions in your code - blocking a user2's access to the data while user1 is modifying it? It sounds like you aren't which is causing your mismatched data

hericles 289 Master Poster Featured Poster

So... what does your code look like? post it up so we can have a look and help you out

hericles 289 Master Poster Featured Poster

On page postback the page is retaining the initially loaded value because the database code is being called again.
You will want your database code to be called inside this structure:

if(!Page.IsPostBack) {
  // call code to populate from database
}

Now that code only runs when the page is first loaded and not on postbacks (which happen when you click a button). The new value entered into textbox should now persist.
Hope that helps,

hericles 289 Master Poster Featured Poster

Hey,
I'm trying to catch the incoming request to my Tomcat server and redirect to another page (a servlet). I don't have Apache installed so no mod_rewrite will work (as I understand it). I need to redirect the incoming request aimed at a standard URL http://www.somesite.com and send it to the localhost:80/someServlet

I installed urlrewritefilter and placed this text in the web.xml file

<filter>
  <filter-name>UrlRewriteFilter</filter-name>
  <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
  <init-param>
    <param-name>confReloadCheckInterval</param-name>
    <param-value>1</param-value>
  </init-param>
  <init-param>
    <param-name>logLevel</param-name>
    <param-value>INFO</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>UrlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

And then in the urlrewrite.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
        "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">


<urlrewrite>

    <rule>
        <note>
            Catch incoming request and redirect to track/Track servlet
        </note>
        <from>www.gpsonline.co.nz</from>
        <to type="redirect">track/Track</to>
    </rule>
</urlrewrite>

There was also the jar file which I put into the lib folder in the same directory as urlrewrite.xml. But Tomcat simply stopped working. Any advice?

Thanks in advance,

hericles 289 Master Poster Featured Poster

He wants to list the products not select just one so DISTINCT won't help.
The problem is with your dataAdapter.

OleDbDataAdapter da = new OleDbDataAdapter(veri);
 DataTable dt = new DataTable();
 da.Fill(dt); // attempt to open an already open connection.

You have already opened the connection with baglan.Open(). da.Fill() then tries to do the same thing but can't because the connection is already open.
You need to decide if you want to use the reader or the dataTable, at the moment you have both and they're just getting in each others way.
Your while(oku.Read()) code makes no sense either. If more than one record is returned the textboxes will simply display the last one in the reader (all records will populate the textboxes but will be instantly overwritten by the next one).

hericles 289 Master Poster Featured Poster

Why not? Explain your situation and we might be able to help you better.

hericles 289 Master Poster Featured Poster

Have you debugged your code while running it? Is the if statement even being called? Because if neither of the if sections get entered then it would appear your dataReader is empty and cannot read.

hericles 289 Master Poster Featured Poster

Is AutoPostBack set to true? Otherwise you may not be calling the SelectedIndexChanged method. You have the onclick="" element of the dropdownlist set correctly?

hericles 289 Master Poster Featured Poster

Wow, I use copy and paste to help a guy out and get down repped. Awesome.

hericles 289 Master Poster Featured Poster

Same post, different user... weird:)
You need to use transactions. Transactions lock the records in use while one user is still altering them, blocking others until the resources are free again. You'll find plenty of examples online but basicallyyou begin a transaction, make your insertions, updates, deletes to the database and then either commit the changes or rollback if an error occurred.

Hope that helps,

hericles 289 Master Poster Featured Poster

Use a datagrid, a repeater or possibly a literal control dependng on how you want to display the results (and whether this is for a web page or form application). Catch your results from the database in a dataTable via a dataAdapter and link that to your chosen output control.

OleDbDataAdapter da = new OleDbDataAdapter(veri);
DataTable dt = new DataTable();
da.Fill(dt); // load results into the dataTable

Then, depending on your chosen display method, use the dataTable to show the results on page.

hericles 289 Master Poster Featured Poster

aldeene's code is a bit random. Why is there code to extract the user name from the database where the userName = txtUser.Text? It will only return what you already have - the entered user name. User is ALWAYS going to equal txtUser.text

All that is really needed is, as you did previously, to select the count of rows in the database where userName = user.Text and password = password.Text. This should provide a count of 1. What error were you getting with that code?

hericles 289 Master Poster Featured Poster

You need to use transactions. Transactions lock the records in use while one user is still altering them, blocking others until the resources are free again. You'll find plenty of examples online but basicallyyou begin a transaction, make your insertions, updates, deletes to the database and then either commit the changes or rollback if an error occurred.

Hope that helps,

hericles 289 Master Poster Featured Poster

You're not using dgv1.Databind() after naming the datasource. That should fix it but you also say you 'think' the database table has data in it. Maybe you should check that too...

hericles 289 Master Poster Featured Poster

For a start if the table name is tbaccession then the columns should be referenced as tbaccession.accno, etc not accno.tbaccession.
You could also post up the actual error you are getting just to help us help you

hericles 289 Master Poster Featured Poster

You can't break it into manageable chunks instead of dealing with the whole thing at once?

hericles 289 Master Poster Featured Poster

Yep, partly, assuming you have a textbox on the page called tbPassword.text and of course the SQL statement needs to be correct for your table and column names.

hericles 289 Master Poster Featured Poster

A trigger to do what? Its hard to give a code example when its not clear what you want. The basic trigger statement looks like this:

CREATE TRIGGER schema.trigger_name 
    BEFORE or AFTER or INSTEAD OF
    DELETE OR INSERT OR UPDATE 
    ON schema.table_name 
    ...

if you intend you use asp.Net to create the trigger send it to the database using executeNonQuery

Hope that helps,

hericles 289 Master Poster Featured Poster

Check out using session variables for recording the logged in status of a user. Each page can check the session state to see if the user is logged in or not and either redirects them to the login page or lets them view the page they are on.
As for logging in, take the user's id and password, check that against what is stored in the database and set the session variable to show logged in status if the details match.
When the user logs out simply clear the session state.
You can examples of all of this on the net or in a book

hericles 289 Master Poster Featured Poster

I take it you are referring to two database tables, True_False and True_False_Details? If they share a common column (like seqNo) just structure an SQL statement that merges the results from the 2 tables.

SELECT tf.question, tf.level, tfd.answer FROM True_False as tf JOIN True_False_Details as tfd ON tf.seqNo = tfd.seqNo WHERE tf.subjectid = 'subjectID' ORDER BY seqNo

Take the output of the SQL statement and use that as the data source for your datagrid.

hericles 289 Master Poster Featured Poster

When you say you were sent new files and you merged them, what were they? Aspx files?
It looks like you have altered something and now your .cs isn't referencing your .aspx page. You could always create a new aspx page and copy the code across if you're really stuck

hericles 289 Master Poster Featured Poster

When the save button is clicked extract the correct password from the database, match it to the entered one and continue with the save procedure if they are the same.
You mention that you save data to the database so you know how to select the password from the database right?

string pwd = tbPassword.Text;  //entered password
SqlConnection conn = new SqlConnection(your connection string);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT password from database table"
conn.Open();
string correctPwd = cmd.ExecuteScalar();
conn.Close();
if(pwd.Equals(correctPwd)) {
  continue saving info
} else {
   display error message
}
hericles 289 Master Poster Featured Poster

I take users don't have to log in to your site or you wouldn't need to protect the comment box, normal log ins could take care of that.
But all you need to do is add another text field to the page for the user to enter the password and then verify that entered password against the one stored in the database or wherever it hides. They match, comment gets saved.

hericles 289 Master Poster Featured Poster

Try changin your requestedExecutionLevel to level="requireAdministrator". Once your program runs as Admin it should be able to access everything. Or alter your code to check real file info is coming back from your getFiles().

hericles 289 Master Poster Featured Poster

Have a look at your .aspx.cs file. In the auto-generated code is the img element still defined as an Image? If it used to be an image but now isn't, that could explain why you're getting the error related to System.Web.UI.HtmlControls.HtmlImage.

hericles 289 Master Poster Featured Poster

Hey,
Can you post up all of the code? I think there is something wrong beyond what you posted here.

hericles 289 Master Poster Featured Poster

Ok, that helps. You can simply mimic that form code on your page and when the user logs in they will be redirected to the second. In my first post I was really asking if you wanted to send the user to the second site or some how use the users credentials on your site.

hericles 289 Master Poster Featured Poster

And your other functions are wrong too. I'm not sure whhy you have an If in your total function.

Function GetTotal(ByVal entries() As Integer, ByVal SIZE As Integer) As Integer
Dim index As Integer = 0
Dim total As Integer = 0
For index = 0 To entries(SIZE)
  total = total + entries(index)
Next
Console.WriteLine()
Console.WriteLine("This is the TOTAL for all entries: " + CStr(total))
End Function

You were returning an element from your array and saying that it was the total. How could it be?

And your average function should be:

Function GetAverage(ByVal entries() As Integer, ByVal total As Integer, ByVal SIZE As Integer) As Integer
Dim average As Integer
average = total/SIZE

Console.WriteLine()
Console.WriteLine("This is the AVERAGE of all numbers entered: " + CStr(average))
End Function

You had already calculated the total and passed it to this function so all that was left to do was the division by SIZE. And again you were returning an element of the array which, although possible,most likely would not be the average.

hericles 289 Master Poster Featured Poster

Hi,
I can see some issues with your lowest and highest functions. Your loop structure is wrong.

Function GetLowest(ByVal entries() As Integer, ByVal SIZE As Integer) As Integer
Dim index As Integer
Dim lowest As Integer = 0
lowest = entries(0)
For index = 0 To entries(SIZE)
If entries(index) < lowest Then
Console.WriteLine()
Console.WriteLine("This is the LOWEST number entered: " + CStr(entries(index)))
End If
Next
End Function

You set lowest to the 1st entry in the array and then check everything against it. Imagine you entered 5,7,9 to the array. Then 5 is not less than 5 so the message does not display at all. The first index can not be lower than itself. But, also, if you entered 13,7 4 to the array you would get the message displayed twice. 7 < 13 and 4 < 13.
Instead you need to run through the loop compairing each entry to the one above it and keeping the lowest.

Function GetLowest(ByVal entries() As Integer, ByVal SIZE As Integer) As Integer
Dim index As Integer
Dim lowest As Integer = 0
For index = 0 To entries(SIZE - 1)
If entries(index) < entries(index + 1) Then
   lowest = entries(index)
Else
   lowest = entries(index + 1)
End If
Next
Console.WriteLine()
Console.WriteLine("This is the LOWEST number entered: " + CStr(lowest))
End Function

The same logic needs to be applied to your highest function.

Hope that helps,

hericles 289 Master Poster Featured Poster

Hi,
Insert commands generally look like
INSERT INTO table VALUES(value1, value2, value3, etc) WHERE so criteriais true

So, in your case, you would have something like this:

Dim cmd As New OleDbCommand
cmd.Connection = connection
cmd.CommandText = "INSERT INTO tableName VALUES(?,?, ?)"
Dim para1 As New OleDbParameter
Dim para2 As New OleDbParameter
Dim para3 As New OleDbParameter
para1.Value = lblTimeIn.Text
para2.Value = lblTimeOut.Text
para3.Value = lblfn.Text
cmd.ExecuteNonQuery()

I'm out of practise with OleDb providers but hopefully I haven't forgotten too much and this is reasonably right. If the table you are inserting into has more than just those three columns you will need to alter the insert statement to be
INSERT INTO tableName(column1, column2, column3) VALUES(?,?, ?)

Hope that helps

hericles 289 Master Poster Featured Poster

Does the other site have an API you need to interact with or are you hoping to send the data to the login page of the second website? If the other site doesn't have the required functionality built into it you may not be able to log in except at their log in page.

hericles 289 Master Poster Featured Poster

Hi,
On the New button set causes validation to False. That will turn stop that button performing any validation when clicked.

hericles 289 Master Poster Featured Poster

Here is an old function I used to create a random text string.

Random rand = new Random();
        string pw = "";
        Char[] chars = new Char[6];
        int count = 0;
        while (count < 6)
        {
            chars[count] = (Char)rand.Next(97, 123);
            pw += chars[count];
            count++;
            
        }

The rand.Next(97, 123) creates a number between 97 and 123 and converts that into a lowercase letter. The digits are numbers (0-9)are 48 - 57 so if you want numbers and letters you might need to add another random function that decides whether to calculate a number or a letter.

Hope that helps,

codeorder commented: nothing personal, I just preffer seeing vb.net code in a vb.net forum. -2
hericles 289 Master Poster Featured Poster

Hi,
I'm a little confused but do you need to send an actual aspx page (with code behind) via email to users of your website and then expect the dowloaded page to work when the user saves it and opens it?
How can you be sure the user can run the page (IIS would need to be installed and running at the very least). Wouldn't simply having that page as part of your website serve the same purpose?
If I've got the wrong idea from your post please let me know...

hericles 289 Master Poster Featured Poster

Hi,
SELECT * FROM purchases WHERE client = 'George' and date >= some_date and date < some_other_date;

Obviously change your table columns to suit but that should work for you.

hericles 289 Master Poster Featured Poster

What Mitja means is that you can easily select the connection string you want to use (and therefore what database you connect to). A drop down box would work for example. All you need is a way to alter which connection string you are referencing at run time.

hericles 289 Master Poster Featured Poster

Have a look at this post:
http://dotnetref.blogspot.com/2008/05/keeping-vbnet-form-always-on-top.html

The user there said they found a solution among what other people had posted. Apparently they used a timer to keep resetting the form's topMost property to true. Might work for you

hericles 289 Master Poster Featured Poster

Exactly the same? With custom errors on you would see a basic message telling you that the details are hidden because custom errors is off etc.
With custom errors off you should see a lot more information, specifically in red at the top of the page a detailed error message.
Is the site currently running on your local machine or is it posted on a server at this point?
Maybe you could post up the full content of the error page.

hericles 289 Master Poster Featured Poster

Hi,
This line
Year = Int32.Parse(input);
is crashing because you are trying to parse letters (non-numeric characters) into an integer. This isn't going to work. A string would have to contain only the digits 0-9 (any number of them) to be parsed to a integer.
Your simplest solution is to wrap that section in a try/catch block where the exception triggers a console message prompting the user to try again. Or first check the string only contains numbers before calling the parse command.

On an aside, you have given your variables captialised names e.g. int Year. Classes generally have uppercase names while variables are lower case (int year). This is an expected convention across most languages and you should follow it. If someone else was to read part of your code and saw Year, they would expect that to be a class.

Hope that helps,

hericles 289 Master Poster Featured Poster

Hi,
Create a loop that runs through the dropdownlist items. Like so:

for(int i = 0; i < dropdownlist.items.count; i++) {
   // access each item and do something with it via 
   // dropdownlist.items[i].ToString() or whatever suits
}

Hope that helps,

hericles 289 Master Poster Featured Poster

Well, in that case you will need to address the javascript code errors. But we can't help you with that because you haven't posted the code with the errors up for us to look at...

hericles 289 Master Poster Featured Poster

Hi,
You will want to have a look at the
ScriptManager.RegisterStartupScript() function. You can assign your javascript code via this method to the updatepanel and then it should fire everytime insteadof just on a full page load.

Hope that helps,

hericles 289 Master Poster Featured Poster

Is this a website you have developed? I don't get an error in FF but in IE I get an error saying ASP.Net AJAX client side framework failed to load and then 2 more saying 'Sys' is undefined.

Some code around the error would help.

hericles 289 Master Poster Featured Poster

In the second link it is done using Flash, you will never get a flash file playing in the top left icon of a .net form.
Unless I missed the point you want to have a moving image in the top left of your .net form correct? You need to use an animated ico.
If you are after some other effect please explain in greater detail.