|
Pete O`Hanlon wrote: Cardinal Fang. Bring out the comfy cushion.
|
|
|
|
|
Hi
i am tryin to write a login page in asp.net using c#
i have created the following method which passes 3 parameters into mySQL database stored procedure
but i am having problems extracting the ouptut value from the database and the server returns the following error
Only MySqlParameter objects may be stored
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
the piece of code with the error is
Line 65: connection.Close();
Line 66: <br />
Line 67: int valid = cmdString.Parameters.Add ("?p_valid");<br />
Line 68: <br />
Line 69:
MySqlConnection connection = new MySqlConnection (connectionString);<br />
<br />
MySqlCommand cmdString = new MySqlCommand();<br />
<br />
cmdString.Connection = connection;<br />
<br />
cmdString.CommandText = "login";<br />
cmdString.CommandType = CommandType.StoredProcedure;<br />
<br />
<br />
MySqlParameter param ;<br />
param = cmdString.Parameters.Add("?p_username", MySqlDbType.VarChar);<br />
param.Direction = ParameterDirection.Input;<br />
param.Value = txtUsername.Text;<br />
<br />
<br />
param = cmdString.Parameters.Add("?p_password", MySqlDbType.VarChar);<br />
param.Direction = ParameterDirection.Input;<br />
param.Value = txtPassword.Text;<br />
<br />
param = cmdString.Parameters.Add("?p_valid", MySqlDbType.Int32);<br />
param.Direction = ParameterDirection.Output;<br />
<br />
<br />
connection.Open();
cmdString.ExecuteNonQuery();
connection.Close();
<br />
int valid = cmdString.Parameters.Add ("?p_valid");<br />
<br />
<br />
<br />
if (valid == 1)<br />
{<br />
Server.Transfer("test.aspx");<br />
}<br />
else if (valid==0)<br />
{<br />
msgbox("your login is not valid)");<br />
}<br />
<br />
<br />
}<br />
<br />
private void msgbox(string p)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
} <br />
}
any help appreciated ps i am new to c#
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all, first post thanks in advance for any help.
I'm having a problem loading an assembly via reflection into a host application. The assembly dll implements an interface written in VB.Net. Users can select which assembly they would like to load from a list in the main application's U.I. which is also written in VB.
I have written VB assemblies that implement the interface and load. I have written C# assemblies that implement the interface and load. I have sent both types of assemblies to London (I am in the U.S.)...the ones in VB load but the app doesn't see the C# assemblies at all
Any thoughts? Thanks.
|
|
|
|
|
Fort Mega wrote: Any thoughts?
Maybe London does not support C#
|
|
|
|
|
Ha ha, a very obvious but appropriate question. Since London approached me with the problem I simply assumed that they did. I have to admit, I don't know how to 'enable' C# in the .NET framework but I think I can figure that one out. Thanks for leaving no stone un-turned!
While I'm looking into that, let's assume that C# IS supported...any other thoughts?
Thanks again
|
|
|
|
|
Fort Mega wrote: but the app doesn't see the C# assemblies at all
Mega, the only information you gave us is that the assemblies are written in (the source code is in) different languages and since that cannot possibly be relevant to the problem how can we have any ideas beyond wild guesses? Maybe the dog ate it.
|
|
|
|
|
OMG THE DOG! I guess I'll need to follow him around for a few days and see if it comes out the other end!
The difference in sourcecode language is the only difference between the assemblies. The application code in London is the same as the code I am testing on in the states thus my initial question was essentially 'is it even possible for the difference in language to play into this problem'. I didn't think that it would but I've been offered differing opinions, I'll be posting some code shortly
|
|
|
|
|
Are you fer cereal?!! Nah really?
Can they really not support C#
|
|
|
|
|
Hi,
is it the C# assemblies are not showing in the list (how do you generate the list?)
or is it they do show but fail to load? (What is the exception then?)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
They don't show in the list at all:
I retrieve all the files from the dll repository using System.IO.Directory.GetFiles
Then I feed that into a function that loads the contents of each assembly into an arraylist:
Dim esa As System.Reflection.Assembly = System.Reflection.Assembly.LoadFrom(path)
Dim types As New System.Collections.ArrayList
For Each ESAtype As Type In esa.GetTypes
types.Add(ESAtype.FullName.Substring(ESAtype.FullName.LastIndexOf(".") + 1))
Next
Return DirectCast(types.ToArray(GetType(String)), String())
The arraylist is then used to populate table rows and the process is repeated for each dll
|
|
|
|
|
Hi,
1.
are you sure the C# assemblies show up in the result of GetFiles() ?
2.
I think we will need to see more code.
the code you have shown so far seems to collect Types from one file.
there must be a loop over the files, code to fill the ComboBox (or whatever shows the list),
and the actual loading code.
3.
Is everything protected with try-catch constructs?
Are you showing Exceptions with ToString() to mske sure you obtain all available info?
4.
If you don't have it already, I would suggest you add logging code that traces the
relevant program flow and shows some intermediate results (such as GetFiles result).
I typically have a log function that takes one string argument, and shows it on the
Console (=output pane in Visual Studio) AND appends it to a log file (so you can
retrieve and study the file from the other side of the ocean...).
I add such code while developping, and I leave it in (but have a simple means to
enable/disable it, through an app setting or something similar).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
First off, thanks for the in depth suggestions. One thing I forgot to mention is that I can't debug directly on London's codebase and I can't reproduce the behaviour at home, even though it's the same code. In response:
1. At home yes. In London I don't know.
2. True: But why would this work any differently in London than in the States? Remember, it is ALL the same code, just a different environment. Regardless, it's something like this:
availableFilePaths = System.IO.Directory.GetFiles(repos)
For Each filePath As String In availableFilePaths
file = filePath.Substring(filePath.LastIndexOf("\") + 1)
classNames = GetClassNames(filePath)
For i As Int32 = 0 To classNames.Length - 1
tableRow = Table.NewRow()
tableRow.Item(0) = file.Remove(file.LastIndexOf("."), 4)
tableRow.Item(1) = classNames(i)
Table.Rows.Add(tableRow)
Next
Next
The actual loading code is irrelevant, the dlls can't be loaded if they can't be selected from the list
3. No try catches in this...bad idea jeans on my part, and unfortunately I can't add them right now
4. I do that too but unfortunately not in this instance and I can't update it right now either. I'm going to follow that advice more often though
This code has been tested, deployed and error free for some time...the introduction of the C# sourcecode is definitely the culprit somehow
|
|
|
|
|
OK, here are some more ideas:
1.
is this the first non-domestic instance? Several software packages have different
deliverables for domestic vs. international users (Windows? .NET? ADO.NET? ...).
I don't know any details though.
2.
Every installation is slightly different; international users would typically have
different regional settings (date/time formatting, currency, number formatting,
language, ...). Not sure how that would affect the matter at hand though, unless you
use special characters in filenames.
3.
if DataColumn[1].Unique is true, the Adds for duplicated classes would fail.
Does the DataTable get loaded from a database file, if so was it initialized in the same
way as yours?
Maybe you can have this tested by having the duplicated VB assemblies removed...
4.
If you catch and ignore exceptions at some higher level, then whatever goes suddenly wrong
would terminate the table filling
5.
I would try and check the facts first:
- are the files really there?
- are they accessible? (same owner, same access rights,...)
- are there any exceptions?
6.
You might consider creating from scratch a small app that just targets the problem area,
checks/logs everything, logs a number of SystemInformation/Environment stuff, and
catches+logs all exceptions at all times...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
1. Yes it is and I have a feeling that there may be some idiosyncrasy in the framework that is affecting this but I have no factual basis for that. I have to do some digging into it
2. True but there are no special characters, etc.
3. Good suggestion. I don't think this is the problem but I'm going to investigate further
4. Right, except that all the VB dlls get added...even if they come in AFTER the C# one(s)
5. Yes, Yes, and what do you mean by exceptions?
6. I think I'm going to try this...tomorrow
I think I have enough to go with for the time being, you have been incredibly helpful and I really appreciate it. Thanks again. When I get this figured out (or don't) I'll post back
|
|
|
|
|
you're welcome.
and good luck!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Fort Mega wrote: all the VB dlls get added...even if they come in AFTER the C# one(s)
IIRC GetFiles() does not reorder the files, it gives them as they come from Windows;
and that order depends on the file system (FAT32, NTFS, ...). NTFS would keep them
alphabetically, FAT/FAT32 does not.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Ohhh...good to know, thanks man!
|
|
|
|
|
Just a quick thought. The C# assemblies are CLS compliant aren't they?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Well, I added [assembly:CLSCompliant(true)] and the project compiled without errors. I have to admit I'm not really knowledgeable in the area. Should that take care of it or are there other steps I ought to take?
|
|
|
|
|
hi
i am new at this group, i am student of information technology , i am working on a project online virtual drive , i need ur help and support to do , i hope this group will help me
thanks
zubair khan
|
|
|
|
|
If you have specific problems and questions, then we'll help if we can. If all you want is for us to do the work for you, then you're on your own.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You might want to start with a specific question. So far, all you've done is said that you "hope this group will help me". Certainly, but you have to ask an answerable question first.
|
|
|
|
|
ok i know i have written to guys before, but i have an issue that i cant deal with..
my visual studio.net program is kinda messed up, its like all the text in the program (excluding the menus and sub-menus) have all decreased in size. when i wanna open a project i cant even read the text ion the box it opens and i the background that used to be white is now grayish, the same color as the rest of the programs interface...
any help in fixing this program will be much appreciated (i even have a screenshot that i can send you in case you dnt understand my problem..
pls help me!!!!!
steven
|
|
|
|
|
In Tools > Options expand the Environment section and select Fonts and Colors. There are multiple items that you can affect, so the best thing to do would be to select the Text Editor in the Show Settings For combo and click the Use Defaults button.
Deja View - the feeling that you've seen this post before.
|
|
|
|