|
Hi..
I'm using sql server 2005 Standard Edition and vs 2005
im trying to get database backup & restore with c# coding its succesfull run in my machine.(Using smo namespace)..my machine are installed management studio so smo retrive server name and DB..
But when i was create exe this backup application and run client machine its not run.. Bcoz client machine only installed express edition not in management studio.. Client machine have some software with Database(path c:\Program Files\Test\) in this case how can i get backup & Restore in client machine...?
Pls help me..?
|
|
|
|
|
you can take help from Here[^]
|
|
|
|
|
Also im trying this..
That's also using smo retrive server name and DB with connect management studio..
But I need all project DB backup without installed management studio, only installed express edition..Bcos client machine have express edition not in management studio..
Any idea.
|
|
|
|
|
PropertyInfo propertys = control.GetType().GetProperty("Font");
tc = System.ComponentModel.TypeDescriptor.GetConverter(propertys.PropertyType);
propertys.SetValue(control, (<big><code>?</code></big>)"Arial", null); modified on Tuesday, February 9, 2010 2:10 AM
|
|
|
|
|
|
Hi
I'm newbie in NHibernate. I've downloaded example from: https://www.hibernate.org/379.html[^]
I can retreive data from database via iquery but i have a problem when I try save data.
Here is code:
Supplier supplier = new Supplier();
supplier.Name = "Supplier5";
Manufacturer manufacturer = new Manufacturer("manufacturer5");
Product product = new Product();
product.Name = "product5";
product.Supplier = supplier;
supplier.ProductList.Add(product);
manufacturer.ProductSet.Add(product);
product.ManufacturerSet.Add(manufacturer);
ITransaction transaction = Session.BeginTransaction();
try
{
Session.Save(supplier);
transaction.Commit();
}
catch (NHibernate.HibernateException nexp)
{
}
I've got an error:
error performing isolated work
InnerException: {"Object reference not set to an instance of an object."}
Here is mapping file supplier.hbm.file:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" default-access="nosetter.camelcase">
<class name="NHibernateExampleApp.Supplier, NHibernateExampleApp" table="SUPPLIER" lazy="true" mutable="true">
<id name="SupplierId" unsaved-value="0" column="ID_SUPPLIER" type="System.Int32">
<generator class="hilo">
<param name="table">hibernate_unique_key</param>
<param name="column">next_hi</param>
<param name="max_lo">10</param>
</generator>
</id>
<bag name="ProductList" table="PRODUCT" cascade="all" fetch="join" inverse="true">
<key column="FK_SUPPLIER" />
<one-to-many class="NHibernateExampleApp.Product, NHibernateExampleApp" />
</bag>
<property name="Name" column="NAME" not-null="true" type="System.String" />
</class>
<query name="suppliers">from Supplier</query>
</hibernate-mapping>
StackTrace:
" at NHibernate.Transaction.AdoNetTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Engine.Transaction.Isolater.DoIsolatedWork(IIsolatedWork work, ISessionImplementor session)\r\n at NHibernate.Engine.TransactionHelper.DoWorkInNewTransaction(ISessionImplementor session)\r\n at NHibernate.Id.TableGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Id.TableHiLoGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.Save(Object obj)\r\n at NHibernateExampleApp.Form1.NHTest() in D:\\rg\\proj_CSharp\\NHibernateExampleApp\\NHibernateExampleApp\\Form1.cs:line 136"
I can see that is a problem with hilo.
I have table: hibernate_unique_key
Column next_hi has value 0
Could someone help me?
ThanksI
modified on Tuesday, February 9, 2010 1:44 AM
|
|
|
|
|
Ok, sorry, problem is resolved. I
|
|
|
|
|
Hello,
Datagridview OrderView;
In the above Datagridview my 2nd column is a checkboxcolumn
Rectangle contentBounds = OrderView.Columns[2].CellTemplate.GetContentBounds(0);
But I cant get the contentBounds of the check box
I m getting the rectangle as x=0 y=0
But actually the checkbox column is made and checkbox appears in the first row.
How can I get the bounds ?
thank you
|
|
|
|
|
|
Don't point back to a previous post I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I'm sorry.
But anybody know how to fix this problem ?
Please help me.
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
Writing shell extensions in anything but .NET 4.0 is not supported and highly inadvisable. You've been shown the article describing why.
|
|
|
|
|
I'm currently writing a wrapper for Fossil (www.fossil-scm.org[^]).
I'm trying to pass two double quoted arguments to cmd.exe, but there seems to be a problem with my command and I can't find what's wrong with it.
here's a snippet of my code:
var proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c " + Command;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.CreateNoWindow = true;
Debug.WriteLine(proc.StartInfo.Arguments);
proc.Start();
Output = proc.StandardOutput.ReadToEnd();
Here are my cases:
======
1
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new \"C:\\Documents and Settings\\Simon\\Bureau\\test1\""
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
Output: "" (doesn't work in my project, but using the same command directly in cmd.exe does work. I don't understand why.)
======
2
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new C:\\hello\\testing\\test1"
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new C:\hello\testing\test1
Output: *works as expected*
======
There seems to be a problem with my second double quoted string, but I don't understand why.
I would be really grateful if anybody could help me on this. I plan to offer this project to the community and it is pretty much my main problem currently.
Thanks a lot.
If it might help: I'm developing with VS.Net 2008 SP1 in C# with the .Net 3.5 Framework.
(I did try looking for answers in the forum, google and other sources, but couldn't find an answer for it.)
|
|
|
|
|
Hi,
I've had such experience long ago. IIRC the proper way to do it is to use double quotes around the smallest chunk of text needing it, so try ...\\"Documents and Settings"\\... , and yes that is a pain.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I followed your suggestion and..
changed:
"C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
to:
C:\\"Documents and Settings"\\Simon\\Bureau\\Fossil\\fossil.exe new C:\\"Documents and Settings"\\Simon\\Bureau\\test1
It works flawlessly.
Thanks a lot Mr. Pattyn.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I have a stored procedure that takes and gives me all the results based on authorFirst and authorLast
works fine when i execute it in sql server
USE [Books]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_SelectBasedonAuthor]
--Variables
@AuthorFirst varchar(50),
@AuthorLast varchar(50)
AS
SELECT Book.*, Authors.*
FROM Book INNER JOIN
(Authors INNER JOIN BookAuthors ON Authors.ID = BookAuthors.AuthorID)
ON Book.ID = BookAuthors.BookID
WHERE AuthorFirst = @AuthorFirst AND AuthorLast = @AuthorLast;
in c# I have the following but obviously it is not filtering correctly and I'm not understanding why
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
try
{
using (var db = new mombooksDataContext(Properties.Settings.Default.BooksConnectionString2))
{
String[] splitstring = null;
string treeviewtext = treeView1.SelectedNode.Text;
splitstring = treeviewtext.Split(',');
var filter = db.usp_SelectBasedonAuthor(authorFirstTextBox.Text, authorLastTextBox.Text);
bindingNavigator1.BindingSource.DataSource = filter.ToList();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
My objective is to click on the author name in the treeview and simply call the stored procedure based on that. and pass the results back so i can navigate the results using the bindingnavigator
|
|
|
|
|
I even tried doing the following but nothing seems to help...
try
{
using (var db = new mombooksDataContext(Properties.Settings.Default.BooksConnectionString2))
{
String[] splitstring = null;
string treeviewtext = treeView1.SelectedNode.Text;
splitstring = treeviewtext.Split(',');
var query = db.Books.SelectMany(o => o.BookAuthors.Where(a => a.Author.AuthorFirst == splitstring[1].ToString()));
bookBindingSource.DataSource = query.ToList();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
do i have to format the returned data somehow in order for the datasoure to understand it ?
|
|
|
|
|
Okay well I got it work sorta but i'm having an issue with the where clause. If i hardcode the value it works fine but when I take and pass it the splitstring[1].tostring() which according to the debugger contains "tony" then i get no results..
1.
String[] splitstring = null;
2.
string treeviewtext = treeView1.SelectedNode.Text.Trim();
3.
splitstring = treeviewtext.Split(',');
4.
5.
var query = from b in db.Books
6.
join ba in db.BookAuthors on b.ID equals ba.BookID
7.
join a in db.Authors on ba.AuthorID equals a.ID
8.
join bn in db.BookNumbers on ba.BookID equals bn.BookID
9.
where a.AuthorFirst ==splitstring[1].tostring()
10.
select b;
at line 9 if i make that where.a.AuthorFirst == "tony" all is fine
however if i leave it like it is then the query ends up being null. if i set splitstring[1] = "tony" in here specifically then it works. does spaces matter or am I overlooking something simple here ?
|
|
|
|
|
What's the "correct" technique for doing a modal loop in C#/Winforms? In MFC, you could use CWnd::RunModalLoop() or implement something similar, and then call EndModalLoop() to end it. Is there something similar already in place in Winforms for this? I haven't found it yet and have the nast suspicion I will need to do this from scratch.
If I do need to write this, do I want to use the raw Win32 message loop calls, or something involving Application.DoEvents()?
Here's what I'd like to happen:
Main UI thread:
send a message to a server via sockets
wait in a modal loop until the server responds or some other error condition is hit
Socket handling thread:
read socket data from server, notify main UI thread when done
|
|
|
|
|
Hi Jim,
IMO that is a strange question. I've never seen an explicit message loop in managed code.
If I understood your question correctly, this is what I might(*) do:
- main thread starts a BackgroundWorker that does the server communication and waits for results;
- meanwhile main thread shows a dialog explaining what is going on, possibly offering a progress indication, and probably offering a "cancel" button.
- when the BGW decides all is done, or when it gives up, show the final status in the existing dialog and either change the "cancel" button into an "OK" button, or, after 2 seconds, close the dialog (by which action the main thread continues).
(*) the alternative is not having a modal dialog at all (since that blocks the entire app), and use a modeless dialog instead. That of course requires a different synchronization technique, as now the main thread would never wait.
[ADDED]
FYI: this[^] may interest you.
[/ADDED]
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Monday, February 8, 2010 3:53 PM
|
|
|
|
|
Hello,
I have a datagridviewcheckboxcell in a datagrid which is displayed properly . I want a text next to the box. Which property should I use?
Thank you
Pritha
|
|
|
|
|
As far as I am aware, there is no property to put text beside the checkbox - the text goes into the column heading where it it less intrusive for the user. If you really must do this, you will probably have to create your own custom control, based on a DataGridViewCheckBoxCell, and incorporate the text yourself. I haven't tried this, so I have no idea what problems you are going to face.
Are you sure you need it, given that you can only have true / false / grey in the checkbox anyway?If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks you for your reply
I will have to derive a class from DataGridViewCheckBoxCell
Thanks
|
|
|
|
|
Hi all,
I'm sure that this has been asked quite a bit but I can not find a answer to it. I know that I have seen C# prototypes like in C/C++ .h/.cpp files but can not remember how it is done. In the several searches I have done the closest I can come to are partial classes. Is this the right direction? If so what is the proper syntax for declaring them? I like to have the decelerations in a separate file/location so I don't have to search through lines of code just to get to the functions decelerations.
Thanks for the help!!!!
-Andy
|
|
|
|