Lusiphur 185

[QUOTE=new SE;1304948]Hi,
what should i use to make the data inserted is in all capital letter?
here is insert statement:
[CODE] string query = "INSERT into Categories values (' " + textbox5_value + " ', ' " + textbox6_value + " ', ' " + textbox7_value + " ' )";[/CODE]

strToUpper() is used to make it convert to all capital letter but i don't know where should i put it? can i use this?[/QUOTE]You can do it in the following way assuming that your values are already in string form:[CODE]string query = "INSERT into Categories values (' " + textbox5_value.ToUpper() + " ', ' " + textbox6_value.ToUpper() + " ', ' " + textbox7_value.ToUpper() + " ' )";[/CODE]However, if the input is not in string form then you will need to convert to string prior to appending the .ToUpper().

Lusiphur 185

First, are you using one form/page to login and a separate form/page for your welcome? If so, you would need to look at various methods of passing a variable from the login page to the secondary page.

One such method is to pass the variable as a part of a [URL=""]ClientQueryString[/URL], however this is hardly a 'secure' method of passing unencrypted user information from page to page as it puts the information right there in the URL for everyone to see.

You can also use cookies or sessions to move the information place to place as needed but there are other issues that can arise from either of these methods, particularly if improperly coded.

If, on the other hand, your login page is one and the same with your main page (which can be accomplished using [URL=""]ASP:Panel[/URL]s and simply hiding the login panel and showing the Welcome panel upon successful login) you can pass the variable directly within the same page as a local variable without the bother of moving it around between pages. This has the combined benefit of keeping the variable information masked from the user end and not requiring messy transferrance of information outside of the local scope.

Not sure if either option will do what you need but hope this helps :)

Lusiphur 185

Perhaps I'm misreading this but...

It sounds to me like you're passing the UN/PW to the DB to check if they're valid for a login and want to then get the UN back from the DB for the purpose of a welcome page.

This may sound silly but... why not simply use the UN that was entered in the first place instead of revisiting the DB for the information?

Alternately, if the DB contains additional information (such as full name in addition to UN/PW) then it should be a simple matter of using a select statement calling the full name column based on a match to the username column. Something along the lines of:[CODE]"SELECT fullName from LoginTable WHERE userName='" + providedUN + "'"[/CODE]and of course providedUN is the username provided in the login process.

Hope this helps :)

Lusiphur 185

[QUOTE=jv_web;1303378]Unfortunately I wish to add the "selected items" ( listType.SelectedItem.Text ) to the body of the email...[/QUOTE]Just because Rohand's specific example utilized the objEmail.To.Add() example doesn't mean that would be the only thing that would work in this scenario.

Simply replace the unneeded segment with the logic required to insert the specified text to the body of the email as needed and the foreach loop should do what you need.

As indicated, however, if the issue is actually solved, please mark it as solved (link next to the reply text area) so that others (like myself) don't think that more work still needs to be done on this thread :)

Lusiphur 185

Nice intro :) nice to see when someone makes an effort instead of posting a one liner (or half liner) to the community intros forum. Welcome to DaniWeb.

Lusiphur 185

If I understand your question correctly (you didn't give a lot to work with) you're looking for something like this:[CODE]SqlDataAdapter da = new SqlDataAdapter ("SELECT FROM Table WHERE column='@varNameHere'",con);
da.SelectCommand.Parameters.AddWithValue(textBox1.Text);[/CODE]Essentially, you'd need to modify the correct command type within the adapter with the parameter you wanted to add... I am not 100% sure because I haven't tried to manually override the default adapter methods recently but you may also need to actually set your SELECT statement with the use of the following instead of in the actual adapter declaration in order for the SelectCommand methods to work as well:[CODE]da.SelectCommand.CommandText = "SELECT
FROM Table WHERE column='@varNameHere'"[/CODE]Hope this helps (and hope I'm not butchering it at the same time) :)

EDIT: As I thought (and as saravind pointed out before I could finish typing my reply) you do need to set the CommandText separately instead of in the declaration of the adapter when using parameters :)

AngelicOne commented: cleared me up! thanks +1

Lusiphur 185


It sounds to me like you're using a WYSIWYG editor for your website coding.

If you're attempting to modify your frameset file (index.html) and you are using, for example, Adobe Dreamweaver you can access the main frameset (and it's associated settings) by going to Modify > Frameset > Edit NoFrames Content.

Other editors generally use a similar method to modify the frameset page itself.

Alternately, you can copy the metatags from your content frames and manually paste them into the index.html file via a text editor like notepad.

Hope that helps :)

Lusiphur 185

Well the issue with the background not flowing to the bottom of the screen is probably related to it being within a sub-div. A common issue with DIVs (more specifically with dynamically positioned DIVs) is that they tend to only extend as far as the content they hold... the side-effect being that if the background is contained within the DIV it also gets chopped. This has come up a couple of times here at DaniWeb but I've yet to see a solid solution as there is no real way to force a contained (non-absolute) DIV to full screen length that I'm aware of.

Edit: Some other threads with similar DIV height issues:
[URL=""]thread 1[/URL]
[URL=""]thread 2[/URL]

Lusiphur 185

Not to be a party pooper here but it's not looking so hot in FireFox either... the gradient used for the background/foreground gets dark enough to make the text difficult to read near the bottom and the hatching actually makes my screen get that ever so wonderful 'vibrating' look to it when viewed on my computer.

Another thing to note is that on any page that is not working out to "full length" of the screen it is being viewed on, your gradient background is stopping just below your main content area and leaving a plain background colour for the remainder of the screen. I've included a screenshot so you can see what I mean by this.

Aside from that, as I'm not about to install Safari on my PC to try to view the other issue you're posting about could you maybe go into a bit more detail on what exactly is happening in Safari so those who read your thread might be able to help even if they don't specifically have Safari?

Lusiphur 185

It can be difficult to specifically strip code from submitted text in a text box...

Well... not 'difficult' but cumbersome :)

One thing I might recommend would be that you look into [URL=""]Regular Expressions[/URL] as, using that, you can specify strings to be excluded/filtered from submitted text (such as URLs and script openers). The only drawback with the RegEx method is that you kind of have to be specific about the things you are excluding (ie: if you don't specify it, it won't be excluded).

Another thing you can combine with RegEx filtering is [URL=""]SubString[/URL] segments (to catch everything between the opening and closing braces of an HTML or script tag for example). Simply grab everything from the first [URL=""]IndexOf[/URL] to the following closing brace and snip it out. This can add a bit of heft to your coding however and also means a lot more room for error if not coded correctly.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Edit: One thing I forgot to mention is that RegEx is case sensitive so you either need to utilize separate RegEx values for both capital and lower case or convert the input entirely to upper/lower prior to utilizing RegEx on it (which can be detrimental to the valid input from the user).

Lusiphur 185

Try/Catch generally should be used in any scenario where the outcome of your code is not 100% guaranteed to produce the desired result.

An example would be the file.create example that nssltd posted above but it could also be used for things like database manipulation (try to insert information and catch the error if it doesn't work).

Another component not mentioned above but still part of the try/catch family is "finally" which is a 'catch-all' piece of code which fires after both try and catch have completed their bits. Basically 'try' fires up it's piece of code and if it fails then 'catch' steps up and tries to salvage things so the program doesn't fail entirely. Once either of the first two is completed in what they're doing it moves on to 'finally' who steps in to do whatever needs to be done to finish up the task.

This is all part of the larger picture that is 'error handling' within the C# language. For some additional information about this I suggest reading the first 2-3 listings in [URL=""]this google search[/URL] as, looking over the list, they all seem to be good reference points for beginner programmers.

Hope that helps :)

Suzie999 commented: clear, to the point +1

Lusiphur 185

Couple of quick questions to clarify here if possible...[LIST=1]
[]When you say it's closing after 2nd iteration are you talking about the FileSystemWatcher, the DB connection or something else?
]Define iterations in this case... are we talking about the button1_Click event which triggers the StartWatcher() procedure?
[/LIST]I'm asking only because as I'm seeing it right now the following is happening (based on the code provided).[LIST]
[]button1 is clicked
]folder path is selected
[]StartWatcher is called
]watcher is set to monitor selected path for .xls file changes
]streamwriter is created on file change to write the changed files to a list
[]incident event generated for changed file list
]Excel workbook opened based on filename in list
[*]Somewhere in code that is not provided above a database is updated with information from the excel sheet
[/LIST]Throughout this I'm not seeing anything that calls for the FileSystemWatcher to close, however, is it possible that it is closing from a default timeout period being reached?

Also, as the DB connection information was not provided above I am not sure how the connection opening/closing is being handled or how the information is specifically being passed based on the dX and mX variables indicated above so I can't comment on whether or not there might be an issue there at all.

Don't know if this will help at all but more information on the specifics of what is happening and where would probably help solve this :)

Lusiphur 185

Welcome :) Hope you enjoy your stay.

Lusiphur 185

Welcome Daniel, hope you enjoy the forums :)

Lusiphur 185

Below the reply text box it should have a link for solving the thread :)

Lusiphur 185

I may be completely wrong here but I think your entire problem boils down to this row of code:[CODE][/CODE]More specifically to the ReadOnly="True" statement within that row.

[URL=""]This reference[/URL] at is similar in nature to yours but different in the way they bound the data within the GridView however what it boiled down to on their end (for the same error and with the same underlying error code) was that they needed to use the equivalent of EVAL instead of BIND for their read-only GridView segments to avoid this issue occurring.

Not sure how to translate that into the method you're using but it might lead you in the right direction.

Hope this helps :) Please remember to mark threads solved once your issue is resolved.

Lusiphur 185

If I recall from your earlier threads you were writing this with C#/ASP.Net code-behind yes?

If that's the case you can actually (through the use of ) set your URL dynamically from the code-behind instead of trying to set it dynamically on the front end.

With an ASP Hyperlink on the front-end you can code in the back-end whatever URL you need based on criteria determined prior to page-load (or from selections made within other ASP components within the page).

Basically what you end up with is something [URL=""]like this[/URL].

Hope this helps :) Please remember to mark your thread solved once the issue is resolved.

Lusiphur 185

If you MUST close the first form then you're doing it in the wrong order.

Instead of using:[CODE]this.close();
new form3().Show();[/CODE]Try using:[CODE]new form3().Show();
this.close();[/CODE]If you close the only active form prior to opening a new form you get the inadvertant side-effect of terminating the application in most cases.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185

[QUOTE=Niel Johnson;1290579]What should I do???[/QUOTE]What you should do is post a new thread with your own question.

Include samples of your code (specifically the parts involved in the generation and manipulation of your dateTime component) and details of what you're trying to do with the code so that people can take a look and try to help you :)

Resurrecting a 15+ day old thread with something that is not directly related to the original post is usually not going to result in answers for you :twisted:

Lusiphur 185

Well if you set up the table to have the columnn auto-populate then you are correct, you would not need to add a value when submiting a row from your program.

It's only if you do NOT have the column auto-populating dateTime that you would still need to insert a value at the time that the new row is entered.

Lusiphur 185

Ok, loop problem :twisted:

Personally I like to do my loops like so:[CODE]Label1.Text = "";
for (int a = 0; a < ListBox1.Items.Count; a++)
if (ListBox1.Items[a].Selected == true)
Label1.Text += " " + ListBox1.Items[a].Value;
}[/CODE]I [B]think[/B] that might solve your issue. The way your code is written it's taking the "selectedvalue" which I think is basically equating to the most recent or top selected value only and not "all selected values" when writing output.

Lusiphur 185

Question: Do you have a method in place to clear the textBox between button clicks?
Question 2: Are you trying multi-selections [B]after[/B] trying single selections?

I generally would include a Label1.Text = ""; line prior to populating the Label1.Text (prior to the ForEach statement) to ensure that there are no previously entered values already present in the label prior to being filled with 'new' data.

Unless you have listbox items with identical values the only thing I can think of is that you're adding your list of selected items to an already present single selection.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185

Ok, Umm... If you have SQL Server Management Tools available for you for the DB you're working on do this:[LIST=1]
[]choose the Date_Registered column within your table
]Column Properties > General > Default Value or Binding
[*]Enter "getDate()" (without quotes)
[/LIST]It may give you some grief over the fact that prior fields may or may not be already filled in but it will achieve what was suggested by mono.

Alternately, as this is now several days old and it's still not doing what you wanted it to do why not just give up on that if you can't figure it out and instead have the date generated on the application side and inserted at the time of the record being sent like I originally said :)

Either works, mono's method works behind the scenes and without fuss but you seem to be having difficulty implementing it.

See, this is what happens when I buy a new game and take a few days off DaniWeb :twisted:

AngelicOne commented: nice comeback.. xP +1

Lusiphur 185

Keeping in mind that my Red Bull function appears to require a higher value of sleep than I've input... (I've had 2 hours sleep so I'm a bit groggy)...

Might I ask where you're setting your classes up for your win-app? Are you doing so in the program.cs or the formNameHere.cs file?
[CODE]int alertness = RedBull(sleep, ml)

public int RedBull(int sleepHours, int canSize)
int alertness = 0; //Range 1-10
if (sleepHours < 5)
alertness = 1;
return alertness;
//insert crazy complicated calculation based on sleehours and canSize
//return alertness more appropriate to answering questions

Lusiphur 185

[QUOTE=Zinderin;1284557]Hmmmm, ok, I thought the idea behind a static class (remember, I'm still learning) was; you don't have to instance it, and that you shouldn't.[/QUOTE]No, you and farooqaaa are right, this would be a prime example of my brain going into 'standby' mode right in the middle of my Red Bull cycle :P

Lusiphur 185

My bad, but the fact remains that as you stated:

You can't call class members without making an instance of it.

My methodology may be a bit off having been kept awake all night last night :zzz:

Lusiphur 185

You never instantiate AppUtils.

You wrote the class for it but never actually create an instance of the class as such:[CODE]AppUtils myUtils = new AppUtils();[/CODE]All class objects need to be instanciated prior to use.

Your usage would then be:[CODE]aName = myUtils.myDogs[x].Name;[/CODE]Hope that helps :) Please remember to mark the thread solved once your issue is resolved.

[COLOR="red"]Edit: Disregard this, Lusiphur's Red Bull cycle hadn't completed yet and his brain hit 'standby' mode... Was thinking regular (not static) classes when I typed this :twisted:[/COLOR]

Lusiphur 185

If you no longer have a Default2 file then simply change[CODE]<%@ page language="C#" autoeventwireup="true" inherits="Default2, App_Web_caknetlg" %>[/CODE]to this[CODE]<%@ page language="C#" autoeventwireup="true" %>[/CODE]Particularly as the compiler is saying it can't find 'App_Web_caknetlg' either.

For future reference, please name your threads accordingly. Not [B]every simgle thread[/B] that you write needs to be named "" as that tells us nothing about your specific problem.

Lusiphur 185

Lusiphur 185

Ok... first off... this same question was already answered for you [URL=""]at least once[/URL] in the past.

Secondly, this same question was already answered for you [URL=""]at least once[/URL] in the past......

I could list out the 4-5 times you've posted this same question but in the end it boils down to the fact that you have junk in your web.config files that is not compatible with the server settings that are on your web server and you need to eliminate [B]all but the items that are compatible[/B].

There is really no need to keep asking the same question over and over again because you're just going to get the same answer over and over again.

Hope this helps :)