|
If you mean this question[^], you can use the "Add comment" selector beneath the answers to post a reply to the person who gave the answer.
It's time for a new signature.
|
|
|
|
|
Provide a link to your previous question.
|
|
|
|
|
i written below code to execute it is running but not restoring to database. If you know please reply me.
public void restore_data()
{
StreamReader file = new StreamReader("E:\\BackupMysql1\\travel.sql");
string cmd = string.Format(@"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe -u{0} -p(1) -h{2} (3) < {4} ", "root","password1#", "192.168.2.50", "travel", "E:\\BackupMysql1\\travel.sql");
ProcessStartInfo proc = new ProcessStartInfo("cmd", @"/C " + cmd);
//proc.RedirectStandardInput = true;
//proc.RedirectStandardOutput = false;
proc.Arguments = cmd;
proc.UseShellExecute = false;
//Process p = Process.Start(proc);
string res;
//res = file.ReadToEnd();
//p.WaitForExit();
//file.Close();
Process p = new Process();
p.StartInfo = proc;
p.Start();
//res = file.ReadToEnd();
p.WaitForExit();
}
|
|
|
|
|
I don't really understand the code but I did notice what looks like incorrect use of parentheses () instead of braces {} around parameter identities 1 and 3 in the line:
string cmd = string.Format(@"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe -u{0} -p(1) -h{2} (3) < {4} ",
"root","password1#", "192.168.2.50", "travel", "E:\\BackupMysql1\\travel.sql");
It's time for a new signature.
|
|
|
|
|
You don't need to use cmd to run the mysql process. You've only served to complicate your process here.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
problem solved now it is working thank you for all who replied to me
|
|
|
|
|
U can execute through Mysqlcommand as a script.
|
|
|
|
|
Hi All,
I have an application with sends request to a C++ CGI. The response stream comes with a delimiter ( ASC (143) ). I used ASCIIEncoding which returns the data correctly buy wrongly decoded delimiter (I got "?" instead of ASC 143).
I tried UTF7Encoding which returned the delimiter correctly but some data are lost. Does any one has solution for this? I cannot cannot change the CGI layer as its servers as router of more of our legacy applications and my Team Leaders feels that CGI is in perfect shape.
Earlier answers would be appreciated. Thanks in ASAP.
|
|
|
|
|
You have an encoding problem, which you should try and solve using the Encoding class.
There is no such thing as an extended ASCII encoding, or almost everything is an extended ASCII encoding, i.e. most encodings use more than 128 characters and keep the first 128 compatible with ASCII for obvious reasons.
Try using Encoding encoding=new Encoding(codepage); where codepage is an appropriate integer value. In Western-Europe 1252 would be the first one to try. I can't tell for your region though.
Once you have the right Encoding object, either use some of its methods to perform a conversion, or better yet, pass it as an extra parameter to your file operations, e.g. File.ReadAllText(String, Encoding)
|
|
|
|
|
|
Hi,
I am new to Web service. Using ASMX web service, the live data from the database can be shown in Xcelius Dashboard. Sample helloworld.asmx as below used to show "Hello World" in xcelsius dashboard. Xcelsius only support asmx.
<%@ WebService Language="C#"
Class="ProgWS.Ch02.HelloWorldService" %>
using System.Web.Services;
namespace ProgWS.Ch02
{
public class HelloWorldService: WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
I have tried by combining code from www.jonasjohn.de/snippets/csharp/sql-connection-example.htm with above code, I am not succeed.
I would appreciate if you could let me know the sample ASMX C# program to connect SQL Server and return data from a table (adventureworks.Person.Contact.FirstName).
Thanks.
modified on Monday, July 19, 2010 10:38 AM
|
|
|
|
|
You connect to SQL Server the same you normally do, wrapping it in a Web Service doesn't change anything.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for the quick reply, Mark. I have updated as per the "How to get an answer to your question" #7.
I have tried Helloworld.asmx, works fine. I can use the results in xcelsius.
<pre>
<%@ WebService Language="C#"
Class="ProgWS.Ch02.HelloWorldService" %>
using System.Web.Services;
namespace ProgWS.Ch02
{
public class HelloWorldService: WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
</pre>
I have tried the below code and got the "This web service does not conform to WS-I Basic Profile v1.1." error.
<pre>
<%@ WebService Language="C#"
Class="csbook.ch15.Example15_3" %>
using System.Web.Services;
using System;
using System.Data;
using System.Data.SqlClient;
namespace csbook.ch15 {
class Example15_3 {
static void Main(string[] args) {
// create an open the connection
SqlConnection conn =
new SqlConnection("Data Source=philshiv;"
+ "Initial Catalog=AdventureWorks;"
+ "User ID=sa;Password=changeme");
conn.Open();
// create a SqlCommand object for this connection
SqlCommand command = conn.CreateCommand();
command.CommandText = "Select * from Person.Contact";
command.CommandType = CommandType.Text;
// execute the command that returns a SqlDataReader
SqlDataReader reader = command.ExecuteReader();
// display the results
while (reader.Read()) {
string output = reader["CompanyName"].ToString();
Console.WriteLine(output);
}
// close the connection
reader.Close();
conn.Close();
}
}
}
</pre>
Thanks for your time. Could you please help me to resolve the issue.
Thanks
modified on Monday, July 19, 2010 3:45 PM
|
|
|
|
|
|
Thanks for the quick reply, Mark. I have updated as per the "How to get an answer to your question" #7.
I have tried Helloworld.asmx, works fine. I can use the results in xcelsius.
<pre>
<%@ WebService Language="C#"
Class="ProgWS.Ch02.HelloWorldService" %>
using System.Web.Services;
namespace ProgWS.Ch02
{
public class HelloWorldService: WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
</pre>
I have tried the below code and got the "This web service does not conform to WS-I Basic Profile v1.1." error.
<pre>
<%@ WebService Language="C#"
Class="csbook.ch15.Example15_3" %>
using System.Web.Services;
using System;
using System.Data;
using System.Data.SqlClient;
namespace csbook.ch15 {
class Example15_3 {
static void Main(string[] args) {
// create an open the connection
SqlConnection conn =
new SqlConnection("Data Source=philshiv;"
+ "Initial Catalog=AdventureWorks;"
+ "User ID=sa;Password=changeme");
conn.Open();
// create a SqlCommand object for this connection
SqlCommand command = conn.CreateCommand();
command.CommandText = "Select * from Person.Contact";
command.CommandType = CommandType.Text;
// execute the command that returns a SqlDataReader
SqlDataReader reader = command.ExecuteReader();
// display the results
while (reader.Read()) {
string output = reader["CompanyName"].ToString();
Console.WriteLine(output);
}
// close the connection
reader.Close();
conn.Close();
}
}
}
</pre>
Thanks for your time. Could you please help me to resolve the issue.
Thanks
|
|
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: Bing? Really?
it's just an acronym; he meant to say: Blimey I Need Google
|
|
|
|
|
|
|
Hi,
Actually I made a user control that its interface is like "glass windows" in windows vista and seven.
My pattern was this picture[^]
using "Photoshop" and draw every layer with C# and .Net drawing classes, I finally draw it.
In first step, i create a bitmap class and then each layer will be drawn on it using graphic path and brushes and so on.
here is the control.glass panel[^]
(you must first add the "reflect.png" file to your project resources and then add class to project then build, ...)
OK,
my problem is the low efficiency of this control while moving and resizing parent form.
because this works, cause calling "draw" method of the control and when calling of method got a lot, it will be slow down the application and more important, it is very CPU hungry.
I want you to learn me a way to draw the user interface of this control
1-using dot net 2.0
2-efficient, like other windows controls.
is there a way to paint UI using directx,...?(I mean not WPF)
if there is no way, i will remove the reflect part of the code that causes high CPU using.
thank you.
modified on Monday, July 19, 2010 8:32 AM
|
|
|
|
|
Hi,
Most of our readers don't download archives to browse code, you'd get more replies if you'd add the code to the post (using PRE tags) I've included a small snippet of your code below for reference;
public void draw()
{
if (Width < 20 || Height < 20)
{
return;
}
Bitmap b = new Bitmap(Width, Height);
Graphics gr = Graphics.FromImage(b);
GraphicsPath gp=new GraphicsPath();
LinearGradientBrush br;
gr.SmoothingMode = SmoothingMode.HighSpeed;
for (int i = 0; i < 10; i++)
{
gp = DrawRoundRect(i, i, Width - i * 2 - 1, Height - i * 2 - 1, 7);
br = new LinearGradientBrush(Bounds, Color.FromArgb(i * 3, Color.Black),
Color.FromArgb(i * 3, Color.Black), LinearGradientMode.Vertical);
gr.DrawPath(new Pen(br, 4), gp);
br.Dispose();
}
On to your question; you're drawing in a dedicated method, called draw . This builds a bitmap in turn, and setting that as a backgroundimage.
You can paint directly on the canvas by overriding the Paint-handler;
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
} You can then use the Graphics object to draw directly to the canvas of the control.
Next, if your control needs redrawing, don't call the draw method, but call the Invalidate [^] method. Third tip would be to re-using objects like brushes and pens, as opposed to creating new ones each time you have to draw.
Hope this helps
I are Troll
|
|
|
|
|
thanks eddy.(i don't forget your recommendation about source code
i think i already done this. but the program crashed down.
because the paint event consecutive raise.
i will test it again and will report you.
thanks again.
(what about GPU, ...?)
i forgot it:
i want when the form moves, the control paint itself to draw reflect on the glass panel.
when you move form, you will see that the reflect is stable
modified on Monday, July 19, 2010 9:09 AM
|
|
|
|
|
mohammad_b wrote: because the paint event consecutive raise.
The method is called by Windows when it needs to repaint a part of the form. If you post your new paint-handler, we'll look at it
mohammad_b wrote: (what about GPU, ...?)
I'd recommend converting to WPF over trying to directly access the GPU. You could even create your own effects[^].
mohammad_b wrote: i want when the form moves, the control paint itself to draw reflect on the glass panel.when you move form, you will see that the reflect is stable
Yup, your life would be easier using WPF. Using WinForms, you'd have to Invalidate the control to force a repaint. I don't know how this will perform with a large area if you call this method in the OnMouseMove event. You'd have to give it a try to find out.
I are Troll
|
|
|
|
|
thanks again.
first i apologize for my dirty and ugly coding.
when i reopen the class codes and look at it, I ashamed from myself that what is this code that i written.
----
the paint method is good. i switched to it.
I remove all codes and just a simple border drawing code and glow shadow with a new and efficient method is remained.
it still is beautiful
----
now i can't switch to WPF. but it is in my learning progs
bye
|
|
|
|