|
Hi,
When you use the SqlCe Connection and Command object, you don't need to use your dataset anymore.
If you have MSDN installed, you can check the use of these objects (particularly the SqlCeCommand object, since this is the one that actually does the request).
So :
{...}
cmd.Parameters.Add(pass);
int count = cmd.ExecuteScalar();
if (count == 1)
{
MessageBox.Show("Authentification réussie");
MenuP m = new MenuP();
m.Show();
}
else
MessageBox.Show("Login ou mot de passe incorrect veuillez réessayer");
Here's the idea. Courage !
|
|
|
|
|
|
Use Scope_Identity instead. It's the recommended option.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
from msdn
IDENT_CURRENT is similar to the SQL Server 2000 identity functions SCOPE_IDENTITY and @@IDENTITY. All three functions return last-generated identity values. However, the scope and session on which last is defined in each of these functions differ:
* IDENT_CURRENT returns the last identity value generated for a specific table in any session and any scope.
* @@IDENTITY returns the last identity value generated for any table in the current session, across all scopes.
* SCOPE_IDENTITY returns the last identity value generated for any table in the current session and the current scope.
So SCOPE_IDENTITY seems the right one in a multi threaded environment.
|
|
|
|
|
More reason not to use identities at all.
|
|
|
|
|
hi....
I want to upload image using fileupload/asyfileupload control... and want to show in image control...at a time ..
any one can help me.
sir actually problem is this that i do not want to save image in folder before display in image control.
Means first i want to browse image using fileupload control then on open click of subwindow i want to show image in image control for confirmation that selected image is correct and after that i want to save it in folder or database...
Hope u will got my question
-- Modified Tuesday, April 13, 2010 10:21 AM
|
|
|
|
|
first upload it then show it in image control, whats the problem?
|
|
|
|
|
sir actually problem is this that i do not want to save image in folder before display in image control.
Means first i want to browse image using fileupload control then on open click of subwindow i want to show image in image control for confirmation that selected image is correct and after that i want to save it in folder or database...
Hope u will got my question
|
|
|
|
|
Hi.
I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error
ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
my Coding is
OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name
string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')";
OdbcCommand cmd = new OdbcCommand(query, conn);
try
{
conn.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Record Inserted.");
}
finally
{
conn.Close();
}
|
|
|
|
|
Are you sure your user name and password are correct?
The database name appears to be missing as well.
|
|
|
|
|
thanks for reply.
yes username and password is correct. where i put database name???
|
|
|
|
|
OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;DataBase=DataBaseName;UID=sa;PWD=java;");
|
|
|
|
|
|
mjawadkhatri wrote: OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");
try this:
<br />
OdbcConnection conn = new OdbcConnection("DSN=test;UID=sa;PWD=java;");<br />
this is assuming that you have created a DSN entry with name test.
|
|
|
|
|
Try this to include your database nam:
OdbcConnection cn= new OdbcConnection("Driver={SQL Server};Server=mySQLServer;UID=sa;
PWD=myPassword;Database=Northwind;");
Also make sure that your Sql Server 2005 allows remote connections because by default it doesn't!
|
|
|
|
|
|
hi,
i have got 1000 records in access table and i want to read alternate data.
ie 500 records out of 1000.
how to advance the reader to next record?
|
|
|
|
|
You need to implement your own logic in a loop.
Your logic could simply be something like
While reader.Read(){<br />
intCounter++;<br />
if (intCounter % 2 == 0){<br />
Console.WriteLine(reader(0).ToString())<br />
}<br />
}<br />
End While
|
|
|
|
|
|
One of the method is missed in the call stack when code is compiled in release mode. Here is the sample code:
static void Main(string[] args)
{
MyFunc();
Console.ReadKey(false);
}
public static void MyFunc()
{
Console.WriteLine(Program.GetCallStack());
}
public static string GetCallStack()
{
System.Diagnostics.StackTrace callStack = new
System.Diagnostics.StackTrace();
string s = "";
int index = 0;
while (true)
{
System.Diagnostics.StackFrame frame =
callStack.GetFrame(index);
if (frame == null) break;
System.Reflection.MethodBase method = frame.GetMethod();
if (index 0) s = " --" + s;
s = method.DeclaringType.Name + "." + method.Name + "()" + s;
index++;
}
return (s);
}
Why is it so?
Gurpreet
|
|
|
|
|
Make sure that you're created PDB's when compiling in Release configuration.
In VS2008, you can set the property using the project properties -> Build -> Advanced... -> Debug Info.
|
|
|
|
|
My setting is Debug Info=pdb only
but it does not work
Gurpreet
|
|
|
|
|
Hmm, I take it that the PDB's are in the same folder as the dll?
What specifically isn't working?
When I run your code I get the following output (I inserted a Environment.Newline):
Debug:
ThreadHelper.ThreadStart()
ExecutionContext.Run()
HostProc.RunUsersAssembly()
AppDomain._nExecuteAssembly()
Program.Main()
Program.MyFunc()
Program.GetCallStack()
Release (with PDB)
ThreadHelper.ThreadStart()
ExecutionContext.Run()
HostProc.RunUsersAssembly()
AppDomain._nExecuteAssembly()
Program.Main()
Program.MyFunc()
Program.GetCallStack()
|
|
|
|
|
Here is my output (RUN IT VIA COMMAND PROMPT AND NOT F5 in Visual Studio)
C:\Applications\poc\ConsoleApplication1\ConsoleApplication1\bin\Release>consolea
pplication1
Program.Main()Program.GetCallStack() --
C:\Applications\poc\ConsoleApplication1\ConsoleApplication1\bin\Release>cd..\deb
ug
C:\Applications\poc\ConsoleApplication1\ConsoleApplication1\bin\Debug>consoleapp
lication1
Program.Main()Program.MyFunc()Program.GetCallStack() --
NOTE : - Program.MyFunc() is missing in release mode.
Gurpreet
|
|
|
|
|
Anyone has any information on this? Its bit urgent!!
Gurpreet
|
|
|
|