|
Nekshan wrote: U can mail me at nekshan_sweetypie@yahoo.co.in
You'll get lots of spam this way, but no replies.
Nekshan wrote: Now what i donno is how to put a value (this chkbit,loginname & pswd)from my login form(a textbox & checkbox) into database.
Why would you want to ? You're checking the login, not setting it, right ?
How new are you to C# ? Do you know another language ? Did you write the database ? How do you do other database access in your code ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanx graus.
i have checked login,now i want loginid n password which user enters in textboxes into another database.
i m a student of computer science doing project work.
i m trying this code, but no effect :
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=PROGRAMER;Initial Catalog=statusutility;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "INSERT INTO login(userid,password) VALUES (@pUsername,@pPswd)";
SqlParameter p1 = new SqlParameter("@pUsername", SqlDbType.VarChar, 50);
p1.Value = textBox1.Text;
cmd.Parameters.Add(p1);
SqlParameter p2 = new SqlParameter("@pPswd", SqlDbType.VarChar, 50);
p2.Value = textBox2.Text;
cmd.Parameters.Add(p2);
con.Close();
}
can u plz help on it?
Thank You.
Nekshan.
|
|
|
|
|
You're not executing your query - try cmd.ExecuteNonQuery(); before you close the connection. You might find you also need a cmd.Prepare(); after setting your parameters.
It's also good practice to have your open statement in a try block and your close in a finally block.
Instead of using 3 lines for each of your parameters you can create parameters like this
cmd.Parameters.Add("@value", SqlDbType.VarChar, 50).Value = textBox1.Text;
Hope this helps.
|
|
|
|
|
Well, first use try/catch methods if something doesn't work as you wish, it helps you debugging the application a lot.
I think you should use something like this :
try
{
con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO login(userid,password) VALUES('"+textBox1.Text+"','"+textBox1.Text+"')");
cmd.ExecuteNonQuery();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
You can see you aren't using the ExecuteNonQuery function ... maybe that's the problem
regards...
VirtualVoid.NET
|
|
|
|
|
Hi!
Actually i m developing web protal in C# asp.net web application. I want to make EMail client. I have included OpenPOP dll in my project and also its reference. By using OpenPop.Pop3 namespace, how can i receive mails on my server. I m using Kerio mail server. So can anybody guide us how to use the fuctions of this namespace and collect email in my server account.
Thanks
|
|
|
|
|
I am developing application in VS2005 C#, Windows Mobile 5.
Please help, I have some doubts..
1. How to code for softkeys in Windows Mobile?
2. How to add background image?
3.If I closed the application, its still running at the background,I stop running programs also its still running,I need to remove the battery to shutdown the application.How to avoid this?
4.How to install exe file with icon/logo to Windows Mobile programs collection?
I am a newbie for WM development,So, please bear with my questions.
Thanks in advance
|
|
|
|
|
1. Same way as Win Forms. Select the softkey menu in the designer. In Properties change to events view and double click the event you want to handle.
2. Only the PictureBox support BackgoundImage unless you override OnPaint and paint it yourself.
3. That's just the way WM5 handles things. It's 'trying' to be clever. X = minimise not close. You can get apps that override this. I, for example, use sqb Pocket Plus for this.
4. Same way as WinForms. Choose an Icon from the properties of the Form in VS designer.
|
|
|
|
|
Can someone help me regarding my problem.
I want to maintain a database on PocketPC 2002.
What is the database should i choose. can i use MS Access?
i'm developing my applic ation using Visual Stidio 2003 (C#).
Dinesh
|
|
|
|
|
hey i am doin a project on fetching ip address and finding whether there s a mismatch in the ip addrss in the given LAN.. can u please help me out about how to approach this prob?? the platform on which i am workin is c# on dot net..
swetha
|
|
|
|
|
hey i am doin a project on fetching ip address and finding whether there s a mismatch in the ip addrss in the given LAN.. can u please help me out about how to approach this prob??
swetha
|
|
|
|
|
How many application domains can exist in a single operating system process?
Vasini
|
|
|
|
|
A single process can have multiple domains running within it
|
|
|
|
|
Hi!
I have problem in using media player control in web application. Can anyone guide me how can i get this control in web application and how can i use it.
Waiting for urgent reply.
Thanx
|
|
|
|
|
Hi.
About generics ...
We can give the object type to any method or field in a class,
and in compile time pass the disired type (int, float, string , ...).
without generics we can implement generics issue, such above.
now, why we shoud use generics and shoudn't use the discussed method ?
Best wishes
|
|
|
|
|
mehrdadc48 wrote: without generics we can implement generics issue, such above.
No, we can't.
mehrdadc48 wrote: now, why we shoud use generics and shoudn't use the discussed method ?
Well, because otherwise we can't have typesafe containers or other classes/methods that can vary by type.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have the following piece of xml file
<customers>
<customer name="fred" country="US">
<profession>engineer</profession>
<age>35</age>
<level>5</level>
</customer>
<customer name="heath" country="UK">
<profession>Doctor</profession>
<age>45</age>
<level></level>
</customer>
</customers>
i just ask how to parse this little xml file with c# code
once the xmltextreader standed on customer i need to retrieve information of each customer separately .
how can i do this please
Human knowledge belongs to the world.
|
|
|
|
|
Hi
Do you need to upadte Xml or only have to read the xml ?
What is the size of xml if size is big then use xmlReader else you can use DOM object Google for xmlTextReader or reader
try
{
XmlTextReader reader = new XmlTextReader(strUrl);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Hashtable attributes = new Hashtable();
string strURI= reader.NamespaceURI;
string strName= reader.Name;
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name,reader.Value);
}
}
StartElement(strURI,strName,strName,attributes);
break;
//
//you can handle other cases here
//
//case XmlNodeType.EndElement:
// Todo
//case XmlNodeType.Text:
// Todo
default:
break;
}
}
catch (XmlException e)
{
Console.WriteLine("error occured: " + e.Message);
}
|
|
|
|
|
I have created a text editor. I created my own filetype for its documents. But when i double click on one of the documents, it just opens a blank one, instead of reading the one double clicked on. It is an MDI form container, one that is main, and all the children are forms with a rich textbox. Currently the only way to open a file is through the open file dialog, by reading all the lines, and setting the rtf of the rich text box as the rtf of the file. I want to know specifically how to open the files by double clicking. So in general, how do i find out the filename of the document double clicked, so i can tell the file to open on startup? (C# .NET 2005).
|
|
|
|
|
The filename is passed as a parameter into your program, so your static void main should take a string[] as a parameter, and it's in there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
can you please give more specifics, i have seen that before, but i don't know how to get the filename from using that. Please give some code example, i am a noob and have only been coding for a few months.
Say it takes the parameters string[] args. When i tell it to open the file from the filename args[0], it throws an error.
|
|
|
|
|
TheBirdman99 wrote: When i tell it to open the file from the filename args[0], it throws an error.
Verify that the filename is being passed through, then check the error. Start with a messagebox to show the values in the array, then you know what you're working with.
What error ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
the error was from the try and catch open metheod. it tries to open the file from the specified filename and then make the rich text box's rtf the same as the files.
i used a for loop to show a message box for each part of string[] args. it showed the file path, but it was split up into four different message boxes. is there a way to combine them all to one string to get the complete path?
i tried using a new string as the full path, but when i use += for each part, the location of "Documents and Settings" becomes "DocumentsandSettings" with no spaces because they were in differnt parts of the array.
|
|
|
|
|
You can use Path.Combine ( in System.IO ) to combine all the strings, but you have to do it a pair at a time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thank you so much!! i got it to finally work. i realized that the message boxes broke at every space, so i told it to add a space after each part like this.
static void Main(string[] args)
{
string fullFileName = "";
for (int i = 0; i < args.Length; i++)
{
fullFileName += args[i] + " ";
}
Application.Run(new Form1(fullFileName));
}
|
|
|
|
|
Sorry, but this is wrong.
You must tell Windows to pass the entire path name as one object;
whatever else you try will take unnecessary code, that will eventually fail on
special cases (e.g. a path containing two consecutive spaces).
The easiest way is to specify "%1" rather than %1 in the registry entries that you
created to link the file extension (or the Explorers "open with myApp" menu item) to your app.
After doing so, Environment.GetCommandLineArgs[1] will yield the complete file spec
of the first file you double clicked or selected for "open with myApp".
Luc Pattyn
|
|
|
|