WabiSabi's Profile
Reputation: 51
Whiz
- Group:
- Active Members
- Active Posts:
- 201 (0.23 per day)
- Joined:
- 31-December 10
- Profile Views:
- 2,543
- Last Active:
Mar 25 2013 02:47 PM- Currently:
- Offline
Previous Fields
- Country:
- Who Cares
- OS Preference:
- Who Cares
- Favorite Browser:
- FireFox
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
-
Gorian 
04 Jan 2013 - 15:00 -
raghav.nagana... 
10 Dec 2012 - 04:27 -
no2pencil 
30 Nov 2012 - 06:56 -
P4L 
16 Jul 2012 - 13:33 -
CodingSup3rna... 
23 Jun 2012 - 14:44 -
v0rtex 
12 Jun 2012 - 14:19 -
jimblumberg 
12 Jun 2012 - 14:13 -
Celerian 
12 Jun 2012 - 13:16 -
ishkabible 
12 Jun 2012 - 11:39 -
baavgai 
05 Mar 2012 - 08:09
Posts I've Made
-
In Topic: connecting to ms sql server 2008 using oledb
Posted 29 Nov 2012
C# is a little different so the syntax is different. When the error is something like "did you mean to invoke the method?" then you should call a method. For example cmd.ExecuteReader; should be cmd.ExecuteReader(); This now shows no errors for me but I didn't test it.
public bool validateuser(string password, string username) { OleDbCommand cmd = new OleDbCommand(); // DbConnection db; //cmd.Connection = db.connection; cmd.CommandText = "select * from userlogin where password = ? and username = ?"; cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("", password); cmd.Parameters.AddWithValue("", username); bool found = false; OleDbDataReader dr = default(OleDbDataReader); dr = cmd.ExecuteReader(); if (dr.Read()) { found = true; } return found; }
The following works. I have tested it. I think you need to put whatever provider you actually use, though. Maybe you can get yours working by looking at this example. Good luck!
con = new System.Data.OleDb.OleDbConnection(); con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/ACTUAL_FILEPATH_GOES_HERE.accdb;Jet OLEDB:Database Password=MyDbPassword;"; con.Open(); string comment = "Insert!"; int id = 1; //this is related in the other table... must be an ID from the other table; primary key, maybe? Or just a key... OleDbCommand Cmd = new OleDbCommand("Insert Into Comments([Comment], ContactID) Values (@CommentParam, @ContactIDParam)", con); Cmd.Parameters.AddWithValue("@CommentParam", comment); Cmd.Parameters.AddWithValue("@ContactIDParam", id); Cmd.ExecuteNonQuery(); //OR you can do it this way: OleDbCommand cmd = new OleDbCommand(); cmd.Connection = con; cmd.CommandText = "INSERT INTO Comments([Comment],[ContactID]) VALUES (@Comment, @ID)"; cmd.Parameters.Add("@Comment", OleDbType.VarChar).Value = "HELPME"; cmd.Parameters.Add("@ID", OleDbType.Integer).Value = 2; cmd.ExecuteNonQuery(); con.Close(); -
In Topic: System.Data.SqlClient.SqlException was unhandled
Posted 8 Nov 2012
Thank you for the replies. I tried to do as you suggested, but was unable to get the management studio installed. Apparently you have to uninstall previous versions of SQL Server and then install the express version in order to get the option for the management studio to be available.
But I don't want to uninstall the version I have, since it is the 'regular' version, not express, and was installed by our system admin, not me. So I don't have an installation CD or anything for it. My other programs depend on it, so I can't risk losing it.
At any rate, I tried running my program without using the emulator... and it works with NO errors. So I guess it's just the emulator that doesn't work.
I tried installing the program on a scan gun to see if it would work that way, but it's missing a file or assembly name...
Error message:
"File or assembly name 'System.Data.SqlClient, Version 3.0.3600.0, Culture = neutral', PublicKey Token = 3BE235DF1C8D2AD3', or one of its dependencies, was not found."
//one step forward... two steps back
again thanks for the advice!
-
In Topic: System.Data.SqlClient.SqlException was unhandled
Posted 6 Nov 2012
Thanks for moving it.
I added code to catch the exception and this is what it tells me now.
this.Adapter.SelectCommand.CommandTimeout = 600; //I added this to eliminate possible timeout. Did not fix error. try{ this.Adapter.Fill(dataTable); } catch(System.Data.SqlClient.SqlException e){ System.Windows.Forms.MessageBox.Show(e.Message); }
The error is: Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I found a fix, but I don’t have the SQL Server Management Studio.
http://support.micro.../555332#method2
Is there any other way I can fix this? -
In Topic: Need help with program, the total is not right
Posted 22 Oct 2012
Looks like you need to add it up outside your for loop rather than inside it:
for (month = 1 ; month <= time; month++) //for loop will keep running for the desired lenght of time, and increase by one month until the desired time is met. {//do stuff... }//for loop ends here total_balance += emonthly + iend; //This gets the total balance.
instead of:
for (month = 1 ; month <= time; month++) //for loop will keep running for the desired lenght of time, and increase by one month until the desired time is met. {//do stuff... total_balance += emonthly + iend; //This gets the total balance. }//for loop ends here
Not sure if the interest will be added correctly... that you might still need inside the for loop, then add all the interest to the total outside the for loop. -
In Topic: combo box items doesn't appear created in MFC project using VS2010
Posted 19 Oct 2012
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
- Years Programming:
- 6
Contact Information
- E-mail:
- Click here to e-mail me
Friends
|
|


Find Topics
Find Posts
View Reputation Given




|
Comments
WabiSabi has no profile comments yet. Why not say hello?