|
Hi,
My ConnexionForm contains 2 fields Login and Password.The user types his parameters.The system must verify the existance of this user in its database .sdf.So,I am blocked in relating my database with my interface.
First,Iwanna ask if ADO.NET is installed by default with Visual Studio 2008 or should i install it.
Second,this is my ConnexionForm's code that i haven't got any result with it:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
using System.Configuration;
using System.Text.RegularExpressions;
namespace PFE
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
MenuPrincipal f = new MenuPrincipal();
f.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
String connectionString = null;
try
{
connectionString = ConfigurationManager.ConnectionStrings["boutique"].ConnectionString;
}
catch (Exception e1)
{
Console.WriteLine("Erreur de configuration : {0}", e1.Message);
return;
}
Console.WriteLine("Chaîne de connexion à la base : [{0}]\n", connectionString);
try
{
using (SqlCeConnection connexion = new SqlCeConnection(connectionString))
{
connexion.Open();
MessageBox.Show("success");
}
}
catch (Exception ex)
{
Console.WriteLine("Erreur d'accès à la base de données (" + ex.Message + ")");
}
}
}
}
Thanks a lot for u contribution
|
|
|
|
|
right usually when i read Xml I do it like this :
XmlDocument XmlDoc = new XmloDocument();
XmlDoc.Load("C:\\Example.xml");
XmlNodeList XmlnodeyList = XmlDoc.SelectNodes("Xml/Node");
foreach(XmlNode Nodey in XmlNodeyList)
{
listView1.Items.Add((string.format("{0}", Nodey.Attributes["ExampleNode"].Value.ToString())));
}
Now that then populates a listview with the nodes in the xml file, I now have been pulling my hair out trying get it to red the second area of the nodes for example in the xml file :
<Node ExampleNode='Meh' SecondNode='Example' /> Sorry CodeProject Wouldent display it properally :)
i want it to read the SecondNode but since i have say 4 of them all diffrent i want it to then read it and make a label have the secondnode text from the listview selected item , Here is the code i wrote for it :
string Name = listView1.SelectedItems[0].ToString();
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.Load(XmlPath);
XmlNode Nodey = XmlDoc.SelectSingleNode(string.Format("Xml/Node/{0}", Name));
label1.Text = (string.Format("{0}", Nodey.Attributes["SecondNode"].Value.ToString()));
so on click from the listview it gets the second node etc ,
any help wouyld be grand guys !
Jed
modified on Saturday, April 3, 2010 5:11 AM
|
|
|
|
|
Hi guys,
I want to the validate the user typed credentials such as(username and password) on a windows form against the loged in user. I found the class PrincipalContext which has ValidateCredentials method that takes username and password but it is in framework 3.5. Is there any equivalant methods for framework2.0
Thanks
|
|
|
|
|
On what version of Windows did you install the AD?
Have you tried the empty username/credentialset? It should try to validate the default-principle if the login-information is omitted;
If no credential were specified in the constructor, and the username and password parameters are null, this method validates the default credentials for the current principal.
I are Troll
|
|
|
|
|
I have been all over Google to figure out a way to download a file from YouTube. Well, looking for the code.
I have no clue how its done.
Well, I visited many sites that provided the code (Just Google "Open Source YouTube Downloader" and "C# Download YouTUbe Video".) However, the code I got from them did not download the file. Looked like some string they were looking for was not found on the page.
I also came across an article which stated that YouTube is trying to stop the downloading of videos on other websites and software.
Well, how are some software (commercial) still able to download the video?
If you can help me out, that would be really nice. I am just looking to download .flv, nothing fancy.
Thanks,
Harsimran Singh
1) The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. - Ted Nelson
2) Why is it drug addicts and computer afficionados are both called users? - Clifford Stoll
3) The real danger is not that computers will begin to think like men, but that men will begin to think like computers. - Sydney J. Harris
(Computer code: 00001111 - translation: Hello! :P )
REMEMBER:
"Computers are made for us, we are not made for th
|
|
|
|
|
Perhaps you have to pretend to be a browser. I'd use Fiddler2 to inspect the traffic that goes back and forth between your browser and the YouTube servers when you watch a video. Try to mimic that traffic with your code. If they've built a custom flash control to play the video, that may use some proprietary technique to validate it is being played in their player, which could complicate things. Perhaps the commercial software (Flash?) just captures the resulting video (i.e., that gets played back on the screen) rather than the data sent over the internet. Sorry I can't provide you with a specific solution (only general guidance)... you may need to do some more work to figure this out yourself.
|
|
|
|
|
You are right. YouTube really has complicated things. Some software I downloaded to download files from YouTube, didn't work either.
There might be another way which I just came across. I am using the YouTube Data API, and when I was debugging (hoping to find some clue to the download link), I came across another link, that was a rstp protocol link. I was wondering if there is a way to download a file from that protocol. But I couldn't find anything on Google either.
Sorry, I am not that good with web and desktop combined.
Thanks,
Harsimran Singh
1) The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. - Ted Nelson
2) Why is it drug addicts and computer afficionados are both called users? - Clifford Stoll
3) The real danger is not that computers will begin to think like men, but that men will begin to think like computers. - Sydney J. Harris
(Computer code: 00001111 - translation: Hello! :P )
REMEMBER:
"Computers are made for us, we are not made for th
|
|
|
|
|
I think you are right. After checking with Fiddler, there is a GET method, which sends YouTube the url of the video. The url is pretty complicated and looks like it works on Ip address.
Well, how can I intercept the JSON response from YouTube to the browser with a C# desktop application? I have no clue how to do this. I came across this: http://stackoverflow.com/questions/2077265/json-in-c-sending-and-receiving-data[^], but that wasn't helpful either.
Can you please help me??
Thank you very much,
Harsimran Singh
1) The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. - Ted Nelson
2) Why is it drug addicts and computer afficionados are both called users? - Clifford Stoll
3) The real danger is not that computers will begin to think like men, but that men will begin to think like computers. - Sydney J. Harris
(Computer code: 00001111 - translation: Hello! :P )
REMEMBER:
"Computers are made for us, we are not made for th
|
|
|
|
|
could someone help me change the sound card (if installed more than one) using winmm.dll? I can not use the DirectSound API, for does not support mp3 files. Please someone help me!
|
|
|
|
|
I've never used it for audio, only MIDI which is in the same dll so I assume the principal is the same.
You use the xxxGetNumDevs function to get the number of devices installed. Each of these devices are assigned an ID from 0 to numDevs - 1.
You can call xxxGetDevCaps to get the name and other capabilities of the In or Out device using the ID.
To use the device you call xxxOpen using the ID which will give you an IntPtr which you use to identify the device for all other functions, and you specify a delegate in this function too which will be called for all events of the device (hint: watch out as callbacks may be on a different threads for different events!).
You will need to look in MMSystem.h and this MSDN page[^] to figure out all your P/Invoke signatures and structures.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hello,
I must add the Ctrl+Z character to string at the end for my C# program to work properly.
Here is the hypotetic code:
char ctrl_z= 'what to type';
string the_string = "Text which ends with ctrl+z character" + ctrl_z;
or
string ctrl_z= "what to type";
string the_string = "Text which ends with ctrl+z character" + ctrl_z;
What to type for char and string declaration of ctrl_z , respectively.
SPIRANCA
|
|
|
|
|
char ctrl_z = (char) 26; /ravi
|
|
|
|
|
Someone 1-voted that; I have no idea why...
P.S. Maybe they wanted Unicode char ctrl_z = '\u0026' ;
|
|
|
|
|
Which is why I pay no attention to ratings like "Reputation". I try to help people (when I'm able to) because others have helped me.
/ravi
|
|
|
|
|
Well said.
It is a shame it is only possible to measure the irrelevant, such as up-votes/down-votes, and number of posts. Only by seeing how helpful someone is could you give a proper rating.
|
|
|
|
|
sometimes it is relevant for future use to reader.
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
or
char ch = (char)(0x1A);
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
To make it compilable and readable use the escape sequence in a character constant thus:
string ctrl_z = "\x1A";
char ctrl_z = '\x1A';
It's time for a new signature.
|
|
|
|
|
Hello,
I've seen a number of articles/discussions here regarding reading the region/culture info (System.Globalization) from the OS. What I haven't seen so far is how to set that information programatically via C#. If it's here, please let me know what search criteria you used or if you have an idea of how to do it, even better. I'm thinking that I will have to end up using pinvoke and the API, but wanted to hear your thoughts. I'm looking for a native C# implementation...
Thank you in advance for any and all information.
|
|
|
|
|
|
Hey Ravi,
Thanks for the information. It steered me into the "right" direction for my purpose. I'm writing a unit test and by doing:
regionInfo = new RegionInfo("US");
CultureInfo cultureInfo = new CultureInfo(0x0409);
Thread.CurrentThread.CurrentCulture = cultureInfo;
Assert.AreEqual(regionInfo.TwoLetterISORegionName, regional.GetLocaleCode(), "Locale code is: " + regional.GetLocaleCode());
NOTE: regional.GetLocaleCode() is a call to get the system region settings
I was able to have my Regional settings set to something other than "US" and the tests ran as though the system was set to the "US" regardless.
In curiosity, do you know of a way to commit those settings to the system? Or would that be more of a registry manipulation exercise? Or "C", none of the above.
Thanks again.
|
|
|
|
|
I hope you're not trying to set it globally/permanently.
|
|
|
|
|
No, I'm creating some NUnit tests and I don't want to depend on the system happening to be of a certain setting.
But, having said that, what would be your concern for the ability to set that or said another way, wouldn't there be legitimate reasons for wanting to have the ability to set the value of the region/culture (perhaps programmatic configuration for one)?
Just curious...
|
|
|
|
|
I wouldn't want an application doing it to my system.
|
|
|
|
|
glauben wrote: wouldn't there be legitimate reasons for wanting to have the ability to set the value of the region/culture
I'd have your app off the system and be looking for some way to have you shot, oh lets change all the globalisation setting to iraq or something, sound like a particularly nasty virus to me. Which is why you are having trouble locating a simple way of doing this.
Never underestimate the power of human stupidity
RAH
|
|
|
|