|
Hi All :
I wount to restore DataBase Backup (BackupName.bak) from Device ( C:\ ) to SQL SERVER 2005 with new Name (NewBackupName) by C#.Net Code .
You should to Remmember the Name of ( mdf and ldf ) is defferant of name other backup database , if it the same (mdf and ldf ) name of other Database you should rename file mdf and ldf .
Who I Can do it ?
Thanks for any body hellp me
Thaer
|
|
|
|
|
Thaer Hamael wrote: You should to Remmember the Name of ( mdf and ldf ) is defferant of name other backup database
I dont think so. if you have the .Bak file , you can easily restore to SQL Server 2005 easily using C#
any problem !!! you can ask me
|
|
|
|
|
thanks Mr Abhijit Jana ,
I do it But the Restore Exeption occure by the exeption String the ldf and mdf is Using by other DataBase .
the idea in this case is who to rename the ldf and mdf .
who i can do it ?
thanks Abhijit Jana
Thaer
|
|
|
|
|
can you put the code of restoring over here ?
|
|
|
|
|
hi
My aim is to close a socket which is already open
Socket.close() is raising exception i have tried with few other things still its not closing properly
So if any one knows how to do this then plz do let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
Are you calling the ShutDown() method before you make a call to Close() ?
|
|
|
|
|
thanks for replying
......................will u plz tell me what this ShutDown() does
I would like to brief my problem ..
I am having a mobile application ......so if the mobile switches off i need to close the socket at my end ........
can u tell me the best way to do this .....apart from pinging it continously
its me sid
|
|
|
|
|
sindhutiwari wrote: will u plz tell me what this ShutDown() does
Read it from MSDN[^]
|
|
|
|
|
Hi Sid,
Dear I am also working on socket application. Try this statement "objSock.Shutdown(SocketShutdown.Both);"
|
|
|
|
|
hi Akmal
Dear,Thanks for ur reply .....i have tried that too ..it dint work perfectly...with my application
as u r also working on socket application
will u plz tell me how you are determining the status of client i mean to say connected or disconnected ......u r following two way pinging or any other thing plz do let me know
its me sid
|
|
|
|
|
Dear Sid,
I am using this piece of code in thread.It tells me when client is connected and send data to me.
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 8001);
listener.Bind(endpoint);
listener.Blocking = true;
listener.Listen(0);
Socket objSock = listener.Accept();
objSock.Receive(ReceiveData);
objSock.Shutdown(SocketShutdown.Both);
listener.Close();
S.Akmal
|
|
|
|
|
dear Sid.
did u try the socket.connected property. It returns a boolean value either u r connected or disconnected.
Mr.Syed
|
|
|
|
|
I want to close the Client Socket ....Not the Listner(Server) how u r handeling Client Socket and Socket.Connected returns the previous state
its me sid
|
|
|
|
|
Send me the Exception text on socket.close().
S.Akmal
|
|
|
|
|
static void Main()
{
Application.Run(new Form1());
}
private System.Windows.Forms.GroupBox grpbox;
XPathDocument dom;
XmlDocument doc;
XPathNavigator nav;
XPathExpression expr;
XPathNodeIterator iterator;
int cnt=0;
Label lbl;
TextBox txt;
OpenFileDialog dlg;
TreeNode newTreeNode,rootnode,parentnode;
string text;
int i;
//int cnt = e.Node.GetNodeCount(false);
//string filename;
private void Form1_Load(object sender, System.EventArgs e)
{
//label1.Text = "File Path";
//label1.SetBounds(8, 8, 50, 20);
//filename = Application.StartupPath + "\\Sample.xml";
//textBox1.Text= filename;
//textBox1.SetBounds(64, 8, 256, 20);
button1.Text = "Populate the TreeView with XML";
button1.SetBounds(8, 20, 200, 20);
treeXml.Height = 600;
treeXml.Width = 400;
grpbox = new GroupBox();
grpbox.Height = 600;
grpbox.Width = 400;
grpbox.SetBounds(500, 2, 700, 600);
grpbox.Visible = true;
grpbox.Dock.Equals(Right);
grpbox.Show();
this.Controls.Add(grpbox);
//dom = new XPathDocument(dlg.FileName);
}
// it will acess the xml file into treeview
private void ConvertXmlNodeToTreeNode(XmlNode xmlNode,
TreeNodeCollection treeNodes)
{
TreeNode newTreeNode = treeNodes.Add(xmlNode.Name);
switch (xmlNode.NodeType)
{
case XmlNodeType.ProcessingInstruction:
case XmlNodeType.XmlDeclaration:
newTreeNode.Text = "<?" + xmlNode.Name + " " +
xmlNode.Value + "?>";
break;
case XmlNodeType.Element:
if (xmlNode.Name.ToLower().Equals("node") == true)
{
newTreeNode.Text = "<" + xmlNode.Attributes["label"].Value.ToString() + ">";
}
else
newTreeNode.Text = "<" + xmlNode.Name + ">";
break;
case XmlNodeType.Attribute:
newTreeNode.Text = xmlNode.Name;
// newTreeNode.Text = "ATTRIBUTE: " + xmlNode.Name;
break;
case XmlNodeType.Text:
case XmlNodeType.CDATA:
newTreeNode.Text = xmlNode.Value;
break;
case XmlNodeType.Comment:
newTreeNode.Text = "<!--" + xmlNode.Value + "-->";
break;
}
if (xmlNode.Attributes != null)
{
foreach (XmlAttribute attribute in xmlNode.Attributes)
{
ConvertXmlNodeToTreeNode(attribute, newTreeNode.Nodes);
}
}
foreach (XmlNode childNode in xmlNode.ChildNodes)
{
ConvertXmlNodeToTreeNode(childNode, newTreeNode.Nodes);
}
}
// this is an event on which text box is created...
private void treeXml_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
cnt = e.Node.GetNodeCount(false);
grpbox.Controls.Clear();
for ( i = 0; i < cnt; i++)
{
Label lbl= new Label();
TextBox txt = new TextBox();
//lbl.Name="lbl"+i;
//lbl.Text="lbl"+i;
lbl.Text = e.Node.Text+i;
txt.Name="txt"+i;
txt.Text=txt.Name;
//txt.Text=e.Node.Text+i;
lbl.Left = 200;
lbl.Top = 200 * i;
txt.Left = 250;
txt.Top = 200 * i;
lbl.Show();
txt.Show();
grpbox.Controls.Add(txt);
grpbox.Controls.Add(lbl);
}
}
// this will open an6y xml file stored at your pc.
private void button1_Click(object sender, System.EventArgs e)
{
XmlDocument doc = new XmlDocument();
OpenFileDialog dlg = new OpenFileDialog();
treeXml.Nodes.Clear();
dlg.Title = "Open XML File";
dlg.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ;
if (dlg.ShowDialog() == DialogResult.OK)
{
//imgPhoto.Image = new Bitmap(dlg.OpenFile());
doc.Load(dlg.OpenFile());
}
dlg.Dispose();
ConvertXmlNodeToTreeNode(doc, treeXml.Nodes);
treeXml.Nodes[0].ExpandAll();
}
// insert a node
on this button click i want to a node in tree and thje value or string which is in the text box should add to the new treenode....
but this is not wornking,
private void button2_Click(object sender, System.EventArgs e ,TextBox txt)
{
TreeNode rootnode = treeXml.Nodes[0];
TreeNode parentnode = rootnode.Nodes[0];
newTreeNode = new TreeNode(txt.Text);
treeXml.SelectedNode.Nodes.Add(newTreeNode);
// if( treeXml.SelectedNode != null
parentnode = treeXml.SelectedNode;
parentnode.Nodes.Add(new TreeNode(txt.Text));
}
plz help me in this code.
modified on Thursday, February 07, 2008 1:30:10 AM
|
|
|
|
|
|
Hi,
I have learned how to load language specific string from sattelite assemblies by changing the CultureInfo of the Resource's typed class accessor. Now, I am wondering how can I set the culture specific language for the Microsoft's built in UI. For example, I want to change the language of the TextBox's context menu (Cut, Copy, Paste) as there is no "culture" property available for the class Control. Would you please give me any idea.
Thanks
|
|
|
|
|
use System.Globalization,
There, you will get Cultureinfo and RegionInfo Class.
just go through this.
you can also build custome culture using CultureAndRegionBuilder Class!!!
|
|
|
|
|
I'm trying to design my user interface where the user can change the background/foreground colors according to their preference. The XML file format appears to be the best and I would like any advice on making it as effecient as possible. The file's contents could change multiple times (re-written). Is overwriting XML file a good idea. Is there a better file format?
Thanks guys!
may your code be error free.
(okay, maybe two lines.)
|
|
|
|
|
programmingAddict wrote: Is overwriting XML file a good idea. Is there a better file format?
For reading and writing XML files, you can use XMLDocument class which provides a DOM model for the supplied XML file. This class provides methods for creating new node/attributes etc. For reading XML files efficiently, use XPath .
|
|
|
|
|
Thanks for the info. It will get me jump started. The more I look into XML, the more convinced I am that it's my best option. Some of the replies to this thread thought I was intending on the user writing the strings by hand
My opinion of user interaction with text is to limit the use of a textbox AS MUCH as possible! When the user gets a hold of a textbox that will be inputting critical data, bad things will start happening if serious validation is not done.
Best wishes to your code!
may your code be error free.
(okay, maybe two lines.)
|
|
|
|
|
Depends on what you mean by 'better'.
Of course it is OK to overwrite an XML file. But if you want files that can be hand-edited by the user (think Notepad), .properties files are the way to go.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Vikram A Punathambekar wrote: properties files
What is properties file ?
|
|
|
|
|
Very common in Javaland. Instead of angle brackets, they simply use the equals sign. Example:
dbServer=SERVERNAME
userName=user1 To the lay user, editing these in Notepad is much easier than editing XML files.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
That's fine. Is this commonly used in .NET ?
|
|
|
|