hericles 289 Master Poster Featured Poster

It would appear there isn't. I tried to use a select statement in the where clause but you can't reference the same table that is being updated (deleted from).
Try removing the tblFactSales.*. A delete statement should just be:

DELETE FROM tblFactSales INNER JOIN tmp T 
ON tblFactSales.PRODUCT=T.PRODUCT AND tblFactSales.SHIPTO=T.SHIPTO AND tblFactSales.TIMEID=T.TIMEID

I'm not sure if that will be the problem however because if you are getting to the part where the message box appears then there are no syntax errors in your SQL.

hericles 289 Master Poster Featured Poster

Post up some code and we'll have a look. My initial thought is that your first selector in the external file has a mistake in it.

hericles 289 Master Poster Featured Poster

That code is OK except for 2 things: where you are defining the strKeyWord? It definitely isn't within the method you posted.
And the second % is outside the single quote: strKeyWord & "'% " should be
strKeyWord & "%'"
Also, of course, you need to open the connection, execute the command and close the connection.

hericles 289 Master Poster Featured Poster

So where are you assigning strKeyWord to the string you want to search for? It isn't in the method you have posted up. To avoid that error simply set strKeyword to seomthing before you create the SQL statement.

hericles 289 Master Poster Featured Poster

You're missing a space on the line break at "INNER JOIN tmp T" & "ON FS..."
Its joining it together as INNER JOIN tmp TON FS

hericles 289 Master Poster Featured Poster

Set the autoPostBack for the semester drop down to true (I think it is already) and add the onSelectedIndexChanged event to your code behind. Now when the value in the semester drop down is changed that method will fire and you can make whatever changes you need to the housing drop down.

<asp:DropDownList ID="SemesterDDL" runat="server" DataSourceID="SemesterDS" DataTextField="Semester_Name" DataValueField="Semester_ID" AppendDataBoundItems="true" AutoPostBack="true" onSelectedIndexChanged="SemesterDDL_OnSelectedIndexChanged">

Then in your code behind define the SemesterDDL_OnSelectedIndexChanged method.

hericles 289 Master Poster Featured Poster

The problem is that you aren't storing the result of the first query in a temporary table of the database, you're storing it in a dataset in memory. The database has no knowledge that the dataset exists.
What I don't understand is why you are selecting the data out first when you just want to delete it anyway. Why can't you just go straight to the delete step? Your dataset doesn't hold any information that tblFactSales doesn't.

hericles 289 Master Poster Featured Poster

Change your SQL to have the % sign in front and behind the strKeyWord. This will make the search include anything before or after a 'D'(in your example), not just before like it is now.

hericles 289 Master Poster Featured Poster

If you don't want a gap between the divs reset the margins and padding to zero using CSS.
You can also use the overflow: scroll rule on the gpsDataDiv. It will stay at a max height of 400px but if the content is longer than that a scroll bar will appear and the user can scroll through the content of the div.

hericles 289 Master Poster Featured Poster

To make one section of the page stay in place while the rest scrolls use position:fixed in the CSS.So, if you have a div or relevant container in the master page use the position:fixed on that.
AJAX will let you update part of a page and should be of use to what you are trying to do.

hericles 289 Master Poster Featured Poster

Would the label being too small cause the font to switch back to the default font? I would have thought it would just cut it off... But, I shall try that.

hericles 289 Master Poster Featured Poster

To send an email is fairly easy. First you need to import the System.Net.Mail namespace to get access to everything you need. Then you create an instance of an SmtpClient (which you provide with the details regarding the email account that will be sending the email) and a MailMessage instance which holds the subject, message, attachments, etc. Then send it.
You'll find plenty of good tutorials online. Here is one to start you off:
http://www.dreamincode.net/forums/topic/57355-sending-e-mail-messages-using-c%23/

hericles 289 Master Poster Featured Poster

Say, for example, that you let your user reset their passwords directly on your site (no emails get sent out or anything like that). Then, assuming your user is already logged in, you need two things - their email address or user ID (whatever makes them unique in your database) and the new password.
Then you can use an update statement directly.

UPDATE table_name SET password = new_password WHERE user_id = @user_id

The @user_id being a passed in parameter. And that will reset their password is the simplest way possible.

ppstyle commented: Thank you, it worked! +0
hericles 289 Master Poster Featured Poster

For a start you copied my line of code in and didn't change where I wrote 'table' for the table name. Putting the correct table name in there will help.
Secondly, you are calling a SELECT statement with ExecuteNonQuery(), it should be with ExecuteScalar() as ExecuteNonQuery returns the number of rows affected by the statement not the rows themselves.

hericles 289 Master Poster Featured Poster

First up, you haven't explained what the problem you are having is (that always helps for future reference). But in your BtnChangePass method you are only selecting from the database and then saying the password has been changed. Where are you doing the actual update of the database?

hericles 289 Master Poster Featured Poster

I think the issue lies in here:

After the search, I do a lot of GUI stuff to display the result.

What you do here probably holds the reason the texbox loses focus and it takes two alt-tabs to get back to it. What exactly do you do then?

hericles 289 Master Poster Featured Poster

If lblResult.Text is always zero then this code is not being hit:

if (TextBox1.Text == abc && TextBox10.Text ==fgh )
{
lblStatus.Text = "***Data Already exist***";
count = 1;
return;
}

as count is never being incremented. If equipment_name and vendor_name mark a unique item why don't you check for that in the database rather than pull out all of the info and cycle through it.

SELECT COUNT(product_name) FROM table WHERE equipment_name = something AND vendor_name = something;

If the product is in there the result will be 1 (or more). If zero then do your insert.

hericles 289 Master Poster Featured Poster

Have you closed all open connections when they are no longer needed? You could be hitting the connection pool limit and so the system is waiting for resources to be released. But, to be honest,you would probably be seeing connection timeouts as well as delays if that was the problem.

hericles 289 Master Poster Featured Poster

If the strings are always the same size and the data you need always in the same place the string.subString function will do that much easier.

string.subString(startLocation, NoOfCharactersToReturn)
' for your particulat string
dim part = string.subString(7,3)
hericles 289 Master Poster Featured Poster

I.m guessing it is your INSERT code. INSERT INTO table * isn't valid. If you are inserting into all columns just use INSERT INTO table_name VALUES(...).
Also, remove your custom message and replace it with ex.Message to view the actual error text.

hericles 289 Master Poster Featured Poster

How can it save the data but the data not be visible in the database? Is it just saving the last row of data from the gridview?It looks like you are running through all of the rows of the datagrid, setting the parameters to the values from each row (overwriting the values from the previous row) and calling executeNonQuery once at the end. This will cause the insertion to just record the lastrow only. Is that what you are seeing?

hericles 289 Master Poster Featured Poster

Sorry, you've confused me. Are you saying that if you don't use ExecuteNonQuery the data is inserted but when you do use it you have an error? When you say that the result is added successfully the code simply ran without errors or that you can actually see the data inserted in the database?
In your previous post you mentioned getting an error message, what error was it?

hericles 289 Master Poster Featured Poster

I've been at this for hours - I am trying to display a barcode font in a label. Sounds simple but apparently isn't. I've added the font ttf to the project and added it to the UIAppFont array in the project p-list but the text appears normally (defaults to the normal font). I tried with another ttf font (not barcode, just fancy) and it works fine so I know I have the steps right.
I went the route of creating an image with text but again no luck...
Any hints, tips, random advice?

hericles 289 Master Poster Featured Poster

I just tried this myself and I had the same problem until I cleared the radioButtonList before setting one of the items to be selected. Then it worked.

if (Labell.Text == "Spot Purchase")
{
   RadioButtonList1.ClearSelection();
   RadioButtonList1.Items[0].Selected = true;
}
else if (Labell.Text == "Tendor Purchase")
{
   RadioButtonList.ClearSelection();
   RadioButtonList1.Items[1].Selected = true;
}

I'm looking online now to find out why that is the case. If I find something I'll let you know.

hericles 289 Master Poster Featured Poster

If you are using sql server and only have one instance installed then the default name is your computer name. Only when you install extra instances do they need to have actual, unique names supplied and then you can open up the SQL Management tool to view them.

hericles 289 Master Poster Featured Poster

If you are talking about Windows Forms then the button control has an Image property, you can set that to any image you have residing on your computer. Flashy buttons can be created in Photoshop (costs for a copy) or the the Gimp (free). You can find plenty of free icon sets online, just type free icon sets into Google. Or you can create your own using the many photshop tutorials you find online.

hericles 289 Master Poster Featured Poster

You can set up your 3 statements as you have done and then do this:

Dim transaction As OleDbTransaction = conn.BeginTransaction()
Try
   Dim orderComman As New OleDb.OleDbCommand(sqlInsertOrder, connectionDatabase)
   Dim productCommand As New OleDb.OleDbCommand(sqlInsertProduct, connectionDatabase)
   Dim orderProductCommand As New OleDb.OleDbCommand(sqlInsertOrderProduct,         connectionDatabase)
   conn.Open()
   orderComman.ExecuteNonQuery()
   productCommand.ExecuteNonQuery()
   orderProductCommand.ExecuteNonQuery()
   transaction.Commit()
  conn.Close()

Catch ex As Exception
   transaction.Rollback()
   conn.Close()

Now all 3 commands will execute but only if all 3 run correctly will your database be altered. If anything goes wrong the transaction is rolled back and the database isn't affected by any of the commands. But if you're unsure look online for more examples.

hericles 289 Master Poster Featured Poster

Different inserts of new data are handled as different SQL statements. Set the statement to be the first insert and run it, then repeat until all tables that need to be updated have been. Now to do this properly you will want to look into database transactions. You can open a transaction on a database before you start the inserts and then when you are finished (and everything went well) commit the transaction - the changes take place then. If a problem occurs at any point you make the transaction rollback and it is as if none of the database changes ever occurred.
Without using transactions you can get yourself into a trouble if one insert runs and then a problem occurs.

hericles 289 Master Poster Featured Poster

If the textboxes are being populated with the data then you know the SQL statement is working. In that case, if it is just the checkboxes that aren't being checked the reader must be containing vallues that do not equal "Spot Purchase" or "Tendor Purchase".
Debug your code at the line where result is set to reader["type_of_purchase"] and see what result actually holds.

hericles 289 Master Poster Featured Poster

Adding to a database is similar to what you have above except you have an INSERT or UPDATE statement as your SQL statement. SO, create a database connection object with a valid connection string, create a command object passing in the parameters of your SQL statement and the connection. Then open the connection and call command.executeNonQuery() to add the data.

hericles 289 Master Poster Featured Poster

You haven't told us the error (which helps us for future reference) but I'm going to say the command object isn't working because you haven't provided it with the connection object. Do this with

command.Connection = conn;
hericles 289 Master Poster Featured Poster

For ease of checking for matches, place your user's guesses in an integer array (you can do it for the randoms to if you want) then use the array's Contains method to see if there is a match.

int[] array = new int[4] {ran1, ran2,ran3, ran4};
int[] guesses = new int[4] {guess1,guess2,guess3,guess4};
int score = 0;
for(int i =0; i < array.Length; i++) {
   if(array.Contains(guesses[i]) {
      score++;
   }
}
hericles 289 Master Poster Featured Poster

You can use the arrayWithObjects method:

data = [NSArray arrayWithObjects: your list of stuff, nil];

You need to include the nil, I can't tell you why...

hericles 289 Master Poster Featured Poster

In that particular example they went to a lot of trouble to create an image map where they defined the regions each link would relate too. The page source makes a good example of how to do it yourself. Less accuracy in the borders would make the task a lot simplier.

hericles 289 Master Poster Featured Poster

In that case, you must be doing something wrong. Chris's advice is correct. You create an instance of the form and after that you can pass values to any controls in the form.
Might be time to post up some code so we can have proper look.

hericles 289 Master Poster Featured Poster

And, solved. Feel like a bit of muppet but shutting down my laptop worked...

Has anyone got any ideas about what happened with VS 2010 for that to happen?

hericles 289 Master Poster Featured Poster

Oddly, it seems to be spreading... The button control in my master page still worked this morning and now it brings up the same type of error when the site loads. Earlier, the site would load but moving to another page would cause the problem. I'm stumped:(

hericles 289 Master Poster Featured Poster

OK, I've wasted 2 hours on this so it time to ask for help. I opened up my latest website that I'm working on (VS 2010) this morning and whenever I access a page that uses server side code I get errors like these:

CS1061: 'System.Web.UI.WebControls.Image' does not contain a definition for 'DataBinding' and no extension method 'DataBinding' accepting a first argument of type 'System.Web.UI.WebControls.Image' could be found (are you missing a using directive or an assembly reference?)

It depends on the first control on the page as to what error I get, sometimes it is a Button click event has no defintion. I have removed the offending control and put it back it, several times to no effect.
I haven't seen this before and have no idea what the issue is. It was working when I left yesterday!!
Anyone have any ideas? Please...

hericles 289 Master Poster Featured Poster

Well, you can place two divs side by side if you use this CSS rule on both and the widths combined aren't too wide for the containing element.

display: inline-block;

Other use float: right; on the div you want on the right. Float can have some unexpected effects though depending on the page structure.

hericles 289 Master Poster Featured Poster

When you run the project in debug mode (or normally if you have set exceptions) what error messages do you get (if any)? If you get an error it will tell you if it is caused by the connection to the database or something else.

hericles 289 Master Poster Featured Poster

The error on button 3 is because you are using the same SqlDataSource1 for each of the functions. You already added firstName as a parameter in the 2nd button click method so it doesn't need to be added again.
The error on button 4 is because you try to access the strFirstName in the checkbox items control. You need to cycle through the list items instead (exactly as you did in the 3rd button click) and then access their value:

For Each li As ListItem In Me.CheckBoxListFirstName.Items

Not

For Each strFirstName As String In CheckBoxListFirstName.Items
hericles 289 Master Poster Featured Poster

In the page directives at the top of your .aspx page you need to register the user control.

<%@ Register TagName="whatever" TagPrefix="uc" Src="location_of_control_file" %>

then in the page, where you want it to be, you reference it with the tagPrefix and the name. So, in my example it would be:

<uc:whatever id="" runat="server" />
hericles 289 Master Poster Featured Poster

Yep, you use <style></style> for CSS you want to include in your header file. If you want to use an external stylesheet you use <link href="style_sheet_location" />

hericles 289 Master Poster Featured Poster

external style sheets serve the same purpose as external javascript files; it supports the removal of presentation from functionality, keeping html separate from your css and javascript.

hericles 289 Master Poster Featured Poster

Check the format of the date information coming out of the database. It can appear as YYYY:MM:DD (particulary if you used an SQLfunction to enter the date in the first place) so searching for 03.07.2012 won't find anything. That tripped me up once.

hericles 289 Master Poster Featured Poster

Well, to be fair, you did say you had a problem with reading past the end of the file...

hericles 289 Master Poster Featured Poster

You should see a scrollbar if you have set the Scrollable property to true and the content in the list view takes up more than the allowed content area.

hericles 289 Master Poster Featured Poster

after the database insertion has completed the simplest thing you can do is this:

dropdownlist2.Items.Add(TextBox1.Text);

Or, better, code up another function that selects the employee ID out of the database and adds the resulting dataset to dropdownlist2. You need to do this anyway if you intend to populate the dropdown when the form loads.

hericles 289 Master Poster Featured Poster

If you are using a streamreader and reading a line at a time you can use something like this:

using (StreamReader sr = new StreamReader("File.txt"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
   // your code
}
}

Depending on how you are parsing it may or may not help. Worth a shot:)

hericles 289 Master Poster Featured Poster

OK, if you want the dropdownlist2 to show the newly entered data and everythign before it then then best thing to do is what I suggested above.
1) insert the employee ID into the database
2) on page_load (or call it directly after the insertion) draw the employee info from the database and populate the dropdownlist
2a) You could, instead of hitting the database each time the page reloads, fill the list the first time the page loads and everytime you save an employee ID just add it to the list with

dropdownlist2.Items.Add('the employee ID')

That will save a bit of server resources and data passing back and forth.

As for the insertion problem, tell us what it is and post up some code, we'll have a look.