|
1. Learn basic C#
2. Learn basics of IP, TCP
3. Learn how to display a video (this has nothing to do with streaming it)
4. Learn how to stream video - research protocols and implementations.
5. Learn the basics of creating a server.
5. If you want this on the internet learn the basics of security.
|
|
|
|
|
i need your help ,i want to make selection of table to be dynamic corresponds to selected item from combobox
more description
//to be like that
SqlCommand cmd = new SqlCommand("select * from '" + comboBox1.SelectedItem.ToString() +"'", con);
//not
SqlCommand cmd = new SqlCommand("select * from table1 ", con);
and thanks
|
|
|
|
|
And your problem is?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
i have more than one table and all of them have the same attributes i want to choose the table i want to get info from table i choose from combobox
i want your help because this doesn't work
SqlCommand cmd = new SqlCommand("select * from '" + comboBox1.SelectedItem.ToString() +"'", con);
when i choose table from combobox like school
this error showed : incorrect syntax near 'school'.
modified 16-Mar-12 19:38pm.
|
|
|
|
|
But you have not made clear what your question is.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
in my combobox
i have places like:
school
hospital
club
each one is table in my database
i want when i choose hospital
it returns all hospitals i put in this table & its atributes
and when i choose club
it returns all clubs i put in this table & its atributes
sorry for my bad english
|
|
|
|
|
Take out the single quotes from your query string.
make it
SqlCommand cmd = new SqlCommand("select * from " + comboBox1.SelectedItem.ToString(), con);
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
IMO if you had written the failing SQL statement to the console (or to a log file) you would easily have seen where it went wrong yourself.
PS: if your combobox allows editing, your SQL statement is open for injection attacks, and people could easily delete your tables...
|
|
|
|
|
5!
|
|
|
|
|
Hi...there is problem in backup of database.Here i m providing the code..
try
{
DateTime Time = DateTime.Now;
int year = Time.Year;
int month = Time.Month;
int day = Time.Day;
int hour = Time.Hour;
int minute = Time.Minute;
int second = Time.Second;
int millisecond = Time.Millisecond;
//Save file to C:\ with the current date as a filename
string path ;
string p = saveFileDialog1.FileName;
path = p + year + "-" + month + "-" + day +
"-" + hour + "-" + minute + "-" + second + "-" + millisecond + ".sql";
StreamWriter file = new StreamWriter(path);
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe";
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}",
"root", "123456", "localhost", "userdb");
psi.UseShellExecute = false;
Process process = Process.Start(psi);
string output;
output = process.StandardOutput.ReadToEnd();
file.WriteLine(output);
process.WaitForExit();
file.Close();
process.Close();
MessageBox.Show("backup is created");
}
catch (IOException ex)
{
MessageBox.Show("Error , unable to backup!");
}
}
}
so the problem is when pointer reach to this line-
Process process = Process.Start(psi)
then an existing event is automatically called and i dont think that this event has to do anything with it....the event is this..
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
{
e.Graphics.DrawString("x", e.Font, Brushes.Black, e.Bounds.Right - 15, e.Bounds.Top + 4);
e.Graphics.DrawString(this.tabControl1.TabPages[e.Index].Text, e.Font, Brushes.Black, e.Bounds.Left + 12, e.Bounds.Top + 4);
e.DrawFocusRectangle();
}
}
so because of this i m unable to create a proper backup file...so plz give some suggestion....
|
|
|
|
|
The event has nothing to do with it as you stated; it merely redraws a tabitem.
You're catching the output of the application that you're starting.
string output;
output = process.StandardOutput.ReadToEnd();
What does the string "output" contain?
catch (IOException ex)
{
MessageBox.Show("Error , unable to backup!");
}
Does it show this message? Can you check whether the code throws an exception? Change the errorhandler to something similar like below;
catch (IOException ex)
{
if (System.Diagnostics.Debugger.IsAttached())
{
Console.WriteLine(ex.ToString());
}
else
MessageBox.Show("Error , unable to backup!");
}
Bastard Programmer from Hell
|
|
|
|
|
Sir as u said i have pasted that code but the same thing is happening again.Again after that line code goes to that event dont know why....and one more think backfile is being created but there is nothing in the backup file because after that line code is not executing.....
|
|
|
|
|
I consumed a wsdl file in a windows application as webreference. I called a method from the reference.
At runtime, I'm getting the exception "Method CRService.crRequest can not be reflected."
at below line.
CRService cr = new CRService();
Please guide me to solve this exception
|
|
|
|
|
The likeliest problem here is that CRService.crRequest uses a datatype that .NET doesn't recognise (based on the wsdl is imported).
|
|
|
|
|
How can we identify which type causes the problem.
|
|
|
|
|
how to draw text and how to move,resize on a canvas in wpf
|
|
|
|
|
|
That's the UK's version of google. No offense, but the original is better.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
But Google was financed by a limey so, really, owned by him: the 2 chipmunk boys were just his hacks.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I am very sorry. Were you trying to add something useful that would help a novice like myself, or were you trying to prove that you can form complete a sentence. Honestly, I am only looking for constructive help. Nothing else.
|
|
|
|
|
I think you responded in the wrong spot. This thread is from a very generic question and the first response, not even from me, was to search google. This isn't even your question. Then a few of us enjoyed a little humor during a Friday workday.
I actually did provide you an answer to one of your questions.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I wrote this small program from an example in the C# book and it compile fine, but gives a path error for the file that I am reading. I created an external file at c:\tempPath
Can someone please advise?
Thanks.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationTEST2
{
class Program
{
static void Main(string[] args)
{
string tempPath = Path.GetTempFileName();
string tempPath2 = Path.GetTempFileName();
if (File.Exists(tempPath))
{
byte[] data = File.ReadAllBytes("c:\tempPath");
File.WriteAllBytes(tempPath2, data);
Console.WriteLine("First byte: {0}", data[0]);
Console.WriteLine("Last byte: {0}", data[data.Length]);
Console.WriteLine(data.Length);
}
}
}
}
OUTPUT:
Unhandled Exception: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share)
at System.IO.File.ReadAllBytes(String path)
at ConsoleApplicationTEST2.Program.Main(String[] args) in C:\Users\computerpu
blic\Desktop\ConsoleApplicationTEST2\ConsoleApplicationTEST2\Program.cs:line 20
Press any key to continue . . .
|
|
|
|
|
You need to learn about character escaping in strings.
computerpublic wrote: byte[] data = File.ReadAllBytes("c:\tempPath"); That string is (shown 1 character per line for clarity)
c
:
tab character (\t)
e
m
p
P
a
t
h
What you probably mean is "c:\\tempPath" .
While you are at it, read up on Unicode .
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Peter,
When I make it ("C:\\tempPath", it gives me the following error:
Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'c:\te
mpPath'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share)
at System.IO.File.ReadAllBytes(String path)
at ConsoleApplicationTEST2.Program.Main(String[] args) in C:\Users\computerpu
blic\Desktop\ConsoleApplicationTEST2\ConsoleApplicationTEST2\Program.cs:line 18
Press any key to continue . . .
|
|
|
|