hericles 289 Master Poster Featured Poster

Thats c# (i'm always making that mistake)...
I'll post something more complete in a couple of hours. I'm going to assume your database is set up with a table of teams, a table of players and a table that links the two. I hope thats accurate.

hericles 289 Master Poster Featured Poster

Hi,
In the selectedIndexChanged event of the first combo box you determine the selected index and include that into your SQL string.

string selectedTeam = comboBox1.SelectedItem.ToString();
string sql = "SELECT * FROM yourTable WHERE team = ?selectedTeam;";
cmd.CommandText = sql;
cmd.Parameters.Add("?selectedTeam", MySqlDbType.Varchar);
cmd.Parameters["?selectedTeam"].Value = selectedTeam;

I'm assuming you have a command object called cmd of course. After that open your connection, execute the command, catch the results in a dataTable or reader and import into the second comboBox. I have made so assumptions about your database table design too of course.

codeorder commented: c# in vb.net forum :( -3
hericles 289 Master Poster Featured Poster

In the onTextChanged event of the first text box (or all of them if you want to be really user friendly) split the string into 4 substrings, each 4 characters long. Then just paste each substring into the right text box.
I wouldn't use the return key as a 'move backward' command. It isn't very obvious. I'd expect the return key to move the cursor forward if not submit the form. Code up the backspace key event so that if the length of the text box is zero and the backspace is pressed, focus moves to the previous text box.

hericles 289 Master Poster Featured Poster

Hi,
Use a switch statement to move to the correct option based on the user input (1-5)

switch (input)
{
    case 1: 
        // add address
        break;
    case 2:
        // remove address
        break;
    case 3:
    etc...
}
hericles 289 Master Poster Featured Poster

If you go back and check your variable declaration you have email declared as a double when it should be a string.

hericles 289 Master Poster Featured Poster

OK, MSDN says you can set the ProhibitDTD property to false and pass through the settings yourself to the create() method. Also the create() method can accept nothing as the settings.
So, if you set
settings.ProhibitDtd = false

and then pass the settings into the create() method - which doesn't require a change to your code - it might work. You can read more (but not much) here:
http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.prohibitdtd.aspx

Hope that helps, I want to know what fixes it now too:)

hericles 289 Master Poster Featured Poster

What version of VS are you using? i only ask because the ProhibitDtd method is obsolete according to MSDN. There isn't any DTD declarations in your XML are there? The sample you posted up didn't include any DTD schema.

hericles 289 Master Poster Featured Poster

OMG, I gave you C# code for a VB.net project... Sorry about that. I only just noticed what language you were using.

Dim settings As New XmlReaderSettings()
settings.ValidationType = ValidationType.Schema

That will most likely fix your problem.

hericles 289 Master Poster Featured Poster

You have altered the code I posted up from this:

XmlReaderSettings settings = new XmlReaderSettings();

to this:

XmlReaderSettings (settings = new XmlReaderSettings());

Remove the brackets around the settings and it should work.

hericles 289 Master Poster Featured Poster

try creating your settings rather than using new:

XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;

xmlFile = XmlReader.Create("sample1.xml", settings)

See if that helps.

hericles 289 Master Poster Featured Poster

I'd check the values you are getting out of the data set (name, telephone, email) and confirm they aren't empty strings.

hericles 289 Master Poster Featured Poster

You are calling an insert operation on the data in the texbox - thats inserting into one row of the database (creating a new row as it is an insert, not an update) and then later you are calling the update on your data adapter. The updater is only updating the information it holds which I strongly doubt is the information you just inserted by itself. Does that make sense? You are adding data that does not exist in the data adapter, therefore the adapter can't update it

hericles 289 Master Poster Featured Poster

You are using HTML email for this? Because if yes, the formatting is reasonably easy. Use a table and some CSS in-line styling.

hericles 289 Master Poster Featured Poster

In your code you have this line:

if (cn.State == ConnectionState.Closed)

but I can't see a section where you continue if the cn.State is open. Depending on whether you handled any other opening/closing of that connection you may have a problem (the two functions here look OK but you may have other code that leaves the connection open elsewhere).

Also, you are selecting all from the database where user name and password matches but then, when checking if the data reader has rows you are running the same check again:

if ((rdr.GetString(1) == this.tbx_user.Text) && (rdr.GetString(2) == this.tbx_pwd.Text))

This seems unnecessary as the reader can only contain rows if the user name/password have already been matched.

hericles 289 Master Poster Featured Poster

Um, yes. That is what the .Net part of the name means. Do you know .Net at all, played with a copy of Visual Studio?
Open up google and type in asp.net tutorial. You'll find all the help you need.

hericles 289 Master Poster Featured Poster

An older version of MySQL would work fine, the issue isn't what database you use but how you make the remote application update, unless I've missed the point of the exercise. I wouldn't think database speed would be issue, both MS SQL and MySQL are used as production servers for massive databases.

hericles 289 Master Poster Featured Poster

You'll be coding not doing graphic design. As long as you know you have an issue with red/green colours you can work around it. I don't see that as a hinderance at all.

hericles 289 Master Poster Featured Poster

If you are getting an error please include it in the post; but one solution would be to put the results from the first reader into a dataTable instead of keeping the reader open - so you would be better off using a dataAdapter to fill the dataTable. Then loop through the dataTable using the second reader as you have it here. I think closing the first reader as soon as you can might fix the problem.
Also don't use SELECT * from the database if you don't need all the data. It's lazy and bad practice:)

hericles 289 Master Poster Featured Poster

Hi,
Break your search string into an array of words e.g. an apple would become an array with two items {"an", "apple"}. Check your second string for each item in the array by looping through it and if it is true in every case you have a match.

for(int i = 0; i<array.length;i++) {
   if(string2.contains(array[i]) {
      boolean == true
   } else {
      boolean == false
   }
}

If the boolean value every becomes false you don't have a match.
Hope that helps,

hericles 289 Master Poster Featured Poster

I'd be tempted to do this client side in javascript. If need be you can call a function at the bottom of the page (to ensure everything has finished loading) and alter the position of the div if necessary.

Of course, you could make this work (probably, I haven't tried it) through good use of CSS and applying the right class to the div and text box when you create them

hericles 289 Master Poster Featured Poster

Hi,
For your first question, it should work fine depending on the logic you use of course. You could query strings or session to pass user data around if you need to move from page t page however.

You can put a log in control wherever you want. I find including another page just to hold two text boxes and a button is a waste so I normally include the log in area on the top right and once logged in this area can hold basic account info (whatever seems relevant) and a log out link. This may best be done using a user control and some custom code of your rather than the actual .net login control. I hardly use that.

Hope that helps,
Steve

hericles 289 Master Poster Featured Poster

I had this problem once and although my solution probably isn't the correct one, I had a hidden field with a textbox (not a label) to hold the value. While label text updated via javascript doesn't seem to be available server side, the contents of a textbox is.

Hope that helps,
Steve

hericles 289 Master Poster Featured Poster

Do you have any more information? Does the current form hide but the log in form not display? Does nothing happen at all?

hericles 289 Master Poster Featured Poster

Wouldn't this be more easily done using javascript if you just need to display the div? Does your text box or div have server-side code attached to it which makes client side inappropriate?

hericles 289 Master Poster Featured Poster

How you retrieve the data from the database won't change but in terms of displaying it you could opt to use a repeater control (you've posted this in the asp.net forum so I'm guessing its a web app you're working on).
Whatever you choose (a datagridview will work just fine) you will want to alter the columns to display either text boxes or checkboxes depending on what you need. In the properties of the datagirdview you can specify what control you want to be in a particular column. After that, for text for example, the data from the database would be inserted into the text box rather than displayed as text on the page allowing it to be edited by the user.
I have some sample code on another computer that might be of use if you need more help.

Steve

hericles 289 Master Poster Featured Poster

Obviously when you use the asp:Button its ID is set to "btnclick", right? Because it isn't in the code you posted above.

hericles 289 Master Poster Featured Poster

A mysql connection string is normally server="" database="" uid="" pwd="". I could be wrong but I didn't think data source was valid.

hericles 289 Master Poster Featured Poster

Add this line:
dpDOB.Format = DateTimePickerFormat.Short;
to the code that draws the info from the database. Just place under the rest and it should work. The problem at the moment is that you only have it in the dateTimePicker code segment which is only getting called when you click on it.

hericles 289 Master Poster Featured Poster

Posting up your actual SQL statement would help us a lot

hericles 289 Master Poster Featured Poster

Your code seems to present the message box saying 'please enter a value' and then continues through the rest of the function after that. It doesn't exit to await new input. Also, you've nested your if loops. txtInWage.Text = "" is only tested if txtInHours.Text = "". Meaning txtInHours needs to equal an empty string before txtInWage is checked. If txtInHours has a value entered but txtInWage doesn't you've got a problem.

hericles 289 Master Poster Featured Poster

Once you have your files in a list you can loop through that list and use the getExtension method to return the file extension of each file. That will of course give you quite a few duplicates for each file type so you'd still need to filter that if you wanted a distinct list.

hericles 289 Master Poster Featured Poster

You have looked at the most likely causes given on the error page? And tried the 'things you can try' hints also on that page?

hericles 289 Master Poster Featured Poster

Or try here:
http://msdn.microsoft.com/en-us/library/ms172541(v=vs.80).aspx

Or, try typing windows smartphone development into google and find other links

hericles 289 Master Poster Featured Poster

You could adjust your loop so the fourth iteration uses write instead of writeline or whatever n is if it isn't always 4). Or add proper error checking code to your code that reads the files so it can recover from encountering an empty line (the fact that it crashes means you haven't coded for all eventualities).

hericles 289 Master Poster Featured Poster

Try this:

SELECT t2.date, t3.order FROM Table1 As t1 JOIN Table2 AS t2 JOIN Table3 AS t3 ON t1.userID = t2.userID AND t2.customerID = t3.customerID WHERE t1.userName = 'name';

Use the JOIN and ON statements to connect tables by the columns they have in common (userID for tables 1 and 2, customerID for tables 2 and 3).
Hope that helps.

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

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

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

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

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

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

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,
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

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

Hi,
C# is one of the languages you can program in using ASP.Net, the other is VB.Net.
They both achieve the same thing as they compile the same. Your other main options include Java (JSP's) and PHP, especially if you want to use linux.
The real question is what are you comfortable coding in? The end result will be almost exactly the same regardless of the language you use to code your project.

hericles 289 Master Poster Featured Poster

You could consider using a linkbutton. Then you can pass the gallery id via the command argument of the link button.

<li class="gallery">
<a style="text-decoration:none;" href="galleryData.aspx?gallery_id=<%#Eval("gallery_id") %>">
<img alt="<%#Eval("gallery_name") %>" style="border:0px;" src="photo_load.aspx?gallery_id=<%#Eval("gallery_id") %>&thumbnail=1" />
<span class="below-image"><%#Eval("gallery_name") %></span>
</a>
<asp:LinkButton ID="LinkButton1" runat="server" CommandArgument="<%#Eval("gallery_id") %>" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>
</li>

And then in your code behind access the commandArgument of LinkButton1.