|
Have you tried using the System.Data.SQLClient classes and specifying the .SDF file as the data source
Other than that dont know what to suggest
|
|
|
|
|
Hi musefan.
musefan wrote: Have you tried using the System.Data.SQLClient classes and specifying the .SDF file as the data source
Actually I've known it and I've used it for using the database in my project.
But I'm gonna trace my program and see the content of the database after each query, so I need a program like MSSQL to see content of the database .
As I said I've used SQL Express and VS2008 , but they didn't show anything.
Thanks anyway
|
|
|
|
|
Option 1:
Do you have SQL Server Management Studio? If so then open it and select the Database type as SQL Server Compact Edition and specify the path of sdf file in Database File option. Thats it!!
Option 2:
Open the Server Explorer Window in Visual Studio and right click the Data Connection and click add connection. In Data Source Click Change button and select the SQL Server Compact Edition. Then click OK. Now you will have to specify the path of sdf file.
<edit>
Try this[^]
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
Thanks a lot crudeCodeYogi.
crudeCodeYogi wrote: Do you have SQL Server Management Studio? If so then open it and select the Database type as SQL Server Compact Edition and specify the path of sdf file in Database File option. Thats it!!
I have SQL Express 2008 SP1, Is it appropriate ?
|
|
|
|
|
Mohammad Dayyan wrote: I have SQL Express 2008 SP1, Is it appropriate ?
It should work on SQL Express 2008 also.
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
Thanks. It works.
|
|
|
|
|
i'm a new user of C#.. pls help me how 2 insert data into oracle 10g database???? and also how to fetch data from it???? pls help me soon.. pls provide source code r any idea for that...
thanks in advance!!!
|
|
|
|
|
|
1. Learn how to write.
2. Read the documentation.
3. Ask for a hint, not for source code.
|
|
|
|
|
i'm extremely sorry 4 askin de source code... i don no how to ask ma doubt so i jus typed tat... thank u very much 4 ur guidance... i want to know how to connect oracle 10g database with c#.net...
thanks in advance!!!
|
|
|
|
|
|
Believe me, some of us hate txtspk more!
|
|
|
|
|
well i use predictive text so i wouldnt use 'cuz' well writing an sms message
|
|
|
|
|
ya sure.. i tried of ma own... but i cudn't bring t up.. but i'll try... moreover i don no de way 2 ask my doubt n tis forum....
thanks in advance!!!
|
|
|
|
|
For the past few months Ive had to design a way of keeping a log\ tracking changes to a web app.
Now as this was a urgent requirment, I just kinda got on and did it in the way I knew how to.
But im now at the point where im logging more data and obviously want to be more efficient in how i do this.
So this is what I currently do.
Example:
1.User wants to change a contact phone no, brings up the record, it reads "1234567" user enters "123456789"
presses update and the code will do the following
2.I will do a db look for that customer record (i passed a paramter of the customerid),
grab the contact no and store it in a string, close the connection.
// I question this bit as I all ready pulled out the value once to show to the user (1.)
3.Im now going to update my record with the new value, done.
4. Now i need to log the old value and the new value into my log class which is like
public class Log
{
private bool xLogRecordInserted;
ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
ProfileBase pb;
public Log(string NewComments, string OldComments, int LogCategoryOID, int OID)
{
try
{
string strInsertLog = "INSERT INTO tbl_Log (UserOID, dtRasiedDate, Comments, Comments2, LogCategoryOID, RelatedRecordOID) VALUES (@UserOID_2, @dtRasiedDate_2, @Comments_2, @Comments2_2, @LogCategoryOID_2, @RelatedRecordOID_2)";
Connection c = new Connection("Connection_Log");
//--Connection
SqlConnection con = c.Connect();
//--Commands
SqlCommand cmd_InsertLog = new SqlCommand();
cmd_InsertLog.Parameters.AddWithValue("@UserOID_2",profile.UserID);
cmd_InsertLog.Parameters.AddWithValue("@dtRasiedDate_2", DateTime.Now);
cmd_InsertLog.Parameters.AddWithValue("@Comments_2", NewComments);
cmd_InsertLog.Parameters.AddWithValue("@Comments2_2", OldComments);
cmd_InsertLog.Parameters.AddWithValue("@LogCategoryOID_2", LogCategoryOID);
cmd_InsertLog.Parameters.AddWithValue("@RelatedRecordOID_2", OID);
//--Open Connection
cmd_InsertLog.Connection = con;
//--Command Types
cmd_InsertLog.CommandText = strInsertLog;
// Execute Query and count rows
int intAffectedRows = cmd_InsertLog.ExecuteNonQuery();
if (intAffectedRows > 0)
{
xLogRecordInserted = true;
}
else
{
xLogRecordInserted = false;
}
con.Close();
con.Dispose();
c.Disconnect();
}
catch (Exception ea)
{
xLogRecordInserted = false;
ErrorLog ErrorLogEntry = new ErrorLog("Log.CS", "Log", profile.UserName, ea.ToString(), "Class");
}
}
public bool LogRecordInserted
{
get {return xLogRecordInserted;}
}
}
|
|
|
|
|
Do you have a question to go with all those words?
Can you not pass old number as parameter to avoid excess database query?
Other than that your just logging a change with one query, how else would you be able to do it that would be better
|
|
|
|
|
What sort of database are you using here? I'd recommend putting some of that function into stored procs if you can.
If you update a phone number and log the previous one, you really want that operation to be atomic, which means it should run in a transaction. You could do this in code, but I'd argue a stored proc which replaces the phone number and logs the old one is they way to go.
Personally, I don't care for raw sql commands in code at all. It's ugly, fussy, not as secure, don't get exec plans and you increase the scope of transactions which could slow the system down.
Regards,
Rob Philpott.
|
|
|
|
|
So what is your question? Are you asking for some alternative methods to do this? I'd create a trigger on that table which fires when update happens. In that trigger, you can put the old value to the tbl_log . This will help you to avoid step2.
|
|
|
|
|
So my question was how can i make the code more effcient?,
my DBA wont allow triggers on the SQL db.
|
|
|
|
|
I have 2 tables
>>Tb_orders (date, ... , id_cust1, id_cust2)
>>Tb_customers(id_cust, name ...)
and I need to edit the fields id_cust1, id_cust2 using ComboBox
cBox1.DataSource = Tb_customers;
cBox1.DisplayMember = "name";
cBox1.ValueMember = "id_cust";
cBox1.DataBindings.Add("SelectedValue", Tb_orders, "id_cust1");
cBox2.DataSource = Tb_customers;
cBox2.DisplayMember = "name";
cBox2.ValueMember = "id_cust";
cBox2.DataBindings.Add("SelectedValue", Tb_orders, "id_cust2");
everything is clear but cBox1 and cBox2 have the same value. I dont know what I have to do..
modified on Saturday, January 31, 2009 2:03 AM
|
|
|
|
|
Try to use diffrent data source. I mean create separate Data source object.
|
|
|
|
|
Thank you!
|
|
|
|
|
Hi!
I'd like to send a message, which has an .mht body.
Can someone provide me with some info on how to do this?
I've seen the Chilkat.dll version from google, but for me it is not good
because of its license.
Thanks in adwance.
|
|
|
|
|
Found this link[^] from the discussion going here[^]
It uses the method name CreateMHTMLBody [^], I have never tried that but it may help
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
Thanks,
Unfortunately it is a vb code, but I'll check if i find the same in c#
this cdosys looks interesting.
|
|
|
|