|
You have to set it in the "project properties", in the "build" tab, "platform target". I had the same problem with an old application using access, and it worked fine for me.
I cannot remember: What did I before google?
|
|
|
|
|
Yeah I know!
I already tried this, without success!
|
|
|
|
|
Thanks for your replies, it seems that the .exe need the manifest.
Now it works =)
/closed
|
|
|
|
|
ok, if this worsk for you it also fine.
I cannot remember: What did I before google?
|
|
|
|
|
OK, I don't know what you did that required a manifest, but this problem, as you decribed it, only needed to be compiled to target x86 CPUs. The reason why it doesn't work is because there are no 64-bit providers for Access databases. Since you can't mix 32-bit and 64-bit code in the same process, using an Access database will fail.
|
|
|
|
|
Hi
I want to learn MVC2 and have zero knowledge about it. please suggest some help (ebook, site or some thing else)
Regards
|
|
|
|
|
|
Have you tried msdn?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
|
Start getting a feed from Scott Gu's Blog (Scott Guthrie). He is one of the Gu'rus on all things MVC
"You get that on the big jobs."
|
|
|
|
|
url = @"http://tests.com/video/network_(a).wmv";
client.DownloadFileAsync(new Uri(url), @"..\Video\network_(a).wmv");
Video.Source = new Uri(url);
Video.Play();
I would like to ask about the above coding, this is a download and play video coding correct,
is it consider as progressive streaming, or real time streaming, i am abit lost on this
|
|
|
|
|
Do you download the entire file and then play it?
In that case, you are doing neither of the two.
See here[^] for a discussion on this by MS.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
but is it possible to do the 2 streaming, in expression blend 4 collaborated with C# VS2010 event handler?
|
|
|
|
|
Below is a configuration for a 31x60 dialog I wanted for a small button column which I could load besides my main form. The Height works, but the Width does not go to 31, and although the Debug version says the Form's Width is 31, it still draws something much wider. Is there some minimum width a form can go to?
//
// Utilities
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(32, 60);
this.ControlBox = false;
this.Controls.Add(this.btSettings);
this.Controls.Add(this.btEvents);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(32, 60);
this.MinimizeBox = false;
this.Name = "Utilities";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Utilities";
this.TopMost = true;
this.ResumeLayout(false);
|
|
|
|
|
Not too sure, but is ClientSize the culprit?
|
|
|
|
|
All the property setting you already have plus MinimumSize = 1,1
Why you want to do it though is another question?
[edit] I forgot to add that the forms Text value needs to be empty.
"You get that on the big jobs."
modified on Monday, February 7, 2011 8:01 AM
|
|
|
|
|
Thanks!
It was the Min set to 1,1..I would have guessed the Text.
|
|
|
|
|
Set the MinimumSize property to the same as your MaximumSize property.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Hello Everyone
I have created a login form and when I try to login I get error saying Object reference not set to an instance of an object.
The error I get is in this line of code...
dtAdapter.SelectCommand.CommandText = "SELECT * FROM Users WHERE ID = '" + txtUserId + "' AND Password = '" + txtPassword + "'";
Can someone tell me please if I'm missing something...
thanks in advance
kind regards
lapeci
|
|
|
|
|
You're missing a ton of the code relevant to us answering your question.
Show us how you initialize your adapter and your command. Also ensure that txtUserId and txtPassword are not null objects.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi Marcus
Here is the full code of login button click event...
public partial class ClientLogin : Window
{
public Client client = new Client();
OleDbConnection conn = new OleDbConnection();
OleDbDataAdapter dtAdapter = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand();
OleDbDataReader dataReader;
public ClientLogin()
{
InitializeComponent();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\AP_AE\Desktop\DTPOS_ClientServer\DataBase\DtposMenu.accdb";
}
public void infoChecker(Client formOne)
{
this.client = formOne;
this.Show();
}
static bool IsNumeric(object Expression)
{
bool isNum;
double retNum;
isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum);
return isNum;
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
try
{
if (IsNumeric(txtUserId.Text) & IsNumeric(txtPassword.Text))
{
conn.Open();
dtAdapter.SelectCommand.CommandText = "SELECT * FROM Users WHERE ID = '" + txtUserId.Text + "' AND Password = '" + txtPassword.Text + "'";
dataReader = dtAdapter.SelectCommand.ExecuteReader();
dataReader.Read();
MessageBox.Show(" - You Have Loged In As: - " + dataReader["Access Level"].ToString() + "\n" + "\n" + " - Welcome " + dataReader["Name"].ToString() + "\n" + "\n" + " - To DTPOS - Point Of Sale System ", "Login Successful", MessageBoxButton.OK, MessageBoxImage.Information);
UserLoginModule.UserAccessLevel = dataReader["Access Level"].ToString();
UserLoginModule.UserFullName = dataReader["Name"].ToString();
this.client.startServer(txtIpAddress.Text.ToString().Trim(), Convert.ToInt32(txtPortNumber.Text.ToString().Trim()), Convert.ToInt32(txtUserId.Text.ToString().Trim()), Convert.ToInt32(txtPassword.Text.ToString().Trim()));
if ((dataReader != null))
{
dataReader.Close();
}
this.Close();
}
else
{
MessageBox.Show("You must enter data in order to proceed further. Please try again...", "Error: Non Data Entry", MessageBoxButton.OK, MessageBoxImage.Information);
txtUserId.Focus();
}
}
catch (System.Data.OleDb.OleDbException exception)
{
MessageBox.Show(exception.StackTrace);
MessageBox.Show(exception.ToString(), "Unable to open database!");
}
catch (InvalidOperationException invalidOperationException)
{
MessageBox.Show(invalidOperationException.Message, "An Invalid Operation Exception");
}
finally
{
if ((conn.State == ConnectionState.Open))
{
conn.Close();
}
}
this.Close();
}
kind regards
lapeci
|
|
|
|
|
Hi lapeci,
Just as a side note regarding connections. .NET uses a connection pool so there is no need to have a class variable which represents a connection. Best practises recommends connections should be created, used and disposed of on-the-fly.
Use a class string variable which represents the connection string by all means.
Also your problem is that you need to set the SelectCommand
dtAdapter.SelectCommand = command
"You get that on the big jobs."
|
|
|
|
|
Slightly off topic, but the code snippet is vulnerable to a form of attack called SQL Injection and leaves a wide open security flaw. A user could stick a user name plus the characters '-- to simply bypass the password check, or something far more malicious. A bit vague description but look it up!
Regards,
Rob Philpott.
|
|
|
|
|
Object reference not set to an instance of an object means some reference type variable or property, that is followed by a period, still is null. There are two candidates in the line shown. Most IDE's have debug capabilities to watch the current value, try it and learn to help yourself, we can't guess what exactly you did wrong.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
1. Either dtAdapter or dtAdapter is null.
2. txtUserId and txtPassword look like names of textboxes rather than string. If they are textboxes, you will need to add .Text as well. If they are string, you may want to revisit the naming convention guidelines you are using.
|
|
|
|