|
|
Look at that, it can give you an idea )
conn = new
SqlConnection("Server=(local);DataBase=Northwind;Integrated Security=SSPI");
conn.Open();
// 1. create a command object identifying
// the stored procedure
SqlCommand cmd = new SqlCommand(
"CustOrderHist", conn);
// 2. set the command object so it knows
// to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
// 3. add parameter to command, which
// will be passed to the stored procedure
cmd.Parameters.Add(
new SqlParameter("@CustomerID", custId));
thanks for everything i have...
|
|
|
|
|
if you are using SQL
then you need
1. import the system.data.sqlclient namespace
2. then create a object of sqlconnection with appropriate parameters
3. then either create a objects of sqlcommand and sqldatareader and in commad specify the storedprocedure name or you can also create a object of sqldataadaptar and sqldataset and in sqldataadaptar you can set your stored procedure name.
if u r working on anyother db than import the namespace and create objects accordingly
|
|
|
|
|
|
if you r using SQL please check the below code
string strSqlConnectionstring = "sqlserver details with provider";
System.Data.SqlClient.SqlConnection _ObjSQLCon = new System.Data.SqlClient.SqlConnection(strSqlConnectionstring.ToString());
System.Data.SqlClient.SqlCommand _ObjSqlCom = new System.Data.SqlClient.SqlCommand();
try
{
_ObjSQLCon.Open();
_ObjSqlCom.Connection = _ObjSQLCon;
// your store procedure name
_ObjSqlCom.CommandText = "Your Store procedure name";
_ObjSqlCom.CommandType = System.Data.CommandType.StoredProcedure;
// you can add parameter as per your requirement
// parameter name & datatype should be as per you have mentioned in your procedure
// set the direction of your parameter
// you need to add output parameter in the same way but direction out be output
_ObjSqlCom.Parameters.Add("your parameter name", System.Data.SqlDbType.Char, 50).Direction = System.Data.ParameterDirection.Input;
_ObjSqlCom.Parameters.Add("your output parameter name", System.Data.SqlDbType.Char, 50).Direction = System.Data.ParameterDirection.Output;
_ObjSqlCom.Parameters[0].Value = "your parameter value";
_ObjSqlCom.ExecuteNonQuery();
// to get the output value you can use either array location of that parameter or the parameter name
// if you are confused then just right click on _ObjSqlCom and view it in immediate window after you have executed _ObjSqlCom.ExecuteNonQuery();
}
catch
{
}
finally
{
strSqlConnectionstring = string.Empty;
if (_ObjSqlCom != null)
{
_ObjSqlCom.Dispose();
_ObjSqlCom = null;
}
if (_ObjSQLCon != null)
{
if (_ObjSQLCon.State != System.Data.ConnectionState.Closed)
{ _ObjSQLCon.Close(); }
_ObjSQLCon.Dispose();
_ObjSQLCon = null;
}
}
if you further douts feel free to email me at ashwin@omtechsolutions.com
Ashwin Shetty. Mumbai. India
|
|
|
|
|
Hai all,
In my application i am using the code below i mentioned. But it couldn't converted into flv format and its not saved into specified path .Can any one help me to do this using c#.
Process ffmpeg,hai;
string video;
string mpg;
video = Page.MapPath("new clip_04.wmv");
mpg = Page.MapPath("") + "\\video.flv";
ffmpeg = new Process();
ffmpeg.StartInfo.Arguments = " -i " + video + " -s 480*360 -deinterlace -ab 32 -r 15 -ar 22050 -ac 1 " + mpg;
ffmpeg.StartInfo.FileName = Page.MapPath("ffmpeg.exe");
ffmpeg.Start();
ffmpeg.WaitForExit();
ffmpeg.Close();
|
|
|
|
|
Hi all,
I have a image with point(10,10). I can move that image by using mouse when point to location point(10,10). Now, i am using Graphics.ScaleTransform(0.9f,0.9f) to resize the image. My question is,how can i change the location point of that image after resize?(It should not be at point(10,10) anymore,am i right?)
Any idea or hits are welcome.
regards
cocoonwls
|
|
|
|
|
Dear all,
Finally i am find out a way to do that, below is the sample code
PointF ScalingFactor = new PointF(1, 1);
PointF viewPoint = new PointF((float)(e.X) * (ScalingFactor.X / zoomvalue),
(float)(e.Y) * (ScalingFactor.Y / zoomvalue));
MouseEventArgs WorldPosition = new MouseEventArgs(e.Button,
e.Clicks,
(int)viewPoint .X,
(int)viewPoint .Y,
e.Delta);
Note: Example code refrence from project "DrawToolsForRoman"
regards,
cocoonwls
|
|
|
|
|
I've got the WebBrowser control displaying my html, but it seems to not be able to handle images (I'm using a fully qualified path, and it still doesn't work). What am I missing?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
are you using the "file" protocol? Like
Best regards,
Jaime.
|
|
|
|
|
That doesn't seem to work either.
I also just found out that I can't load/apply an external stylesheet...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Saturday, October 4, 2008 6:13 AM
|
|
|
|
|
John Simmons / outlaw programmer wrote: I also just found out that I can't load/apply an external stylesheet
That's not true, you can use stylesheets in local html files.
Maybe you have not described your problem clearly.
Best regards,
Jaime.
|
|
|
|
|
I didn't say the control couldn't. I was saying I can't get it to. Here's the code:
private string BuildHtml()
{
StringBuilder builder = new StringBuilder("");
builder.Append("<html>");
builder.Append("<head>");
builder.AppendFormat("<base href='{0}' />", Application.StartupPath);
builder.Append("<style>");
builder.Append("body { font-family:arial; font-size:11pt; }");
builder.Append(".articleTable { width:100%; border:0; background-color:Black; ");
builder.Append(" font-family:arial; font-size:11pt; }");
builder.Append(".darkRowChanged { background-color:#B1E3FF; }");
builder.Append(".lightRowChanged { background-color:#E5F6FF; }");
builder.Append(".darkRow { background-color:#EEE; }");
builder.Append(".lightRow { background-color:white; }");
builder.Append(".descText { font-size:9pt;color:#777;margin-top:3; }");
builder.Append(".titleText { font-weight:bold; font-style:italic; }");
builder.Append(".headerRow { background-color:#999; height:20px; line-height:20px; }");
builder.Append(".dataRow { height:60px; }");
builder.Append("</style>");
builder.Append("</head>");
builder.Append("<body>\n");
builder.Append("</body>");
builder.Append("</html>");
return builder.ToString();
}
this.webBrowser1.Navigate("about:blank");
HtmlDocument doc = this.webBrowser1.Document;
doc.Write(string.Empty);
this.webBrowser1.DocumentText = BuildHtml();
I've also tried the following to get the file:
href="./cpam.css"
href="c:\fully\qualified\path\cpam.css"
I have a feeling that if I can find out why either images won't display or the css file won't load, the whole thing will fall into place. I simply don't know what I've missed here, and finding info with google on this problem is impossible because of the lack of documentation anywhere concerning the webbrowser control.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
again, you should try with the file protocol:
href="file://c:\fully\qualified\path\cpam.css"
Best regards,
Jaime.
|
|
|
|
|
I *did* try that and it didn't work.
Everything I've managed to find on the web says that the normal DOS path should work, and nobody else has mentioned the "file://" thing.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Few ideas:
- when you used Application.StartupPath , did you place the css-file in your projects \bin\Debug-directory, not in the project directory?
- you can try using / as directory separator instead of \
- most html-files use double quotes for href's like href="..." so that would be also worth trying.
The need to optimize rises from a bad design
|
|
|
|
|
Ya know, a lot of people wouldn't come back to a thread like this simply to admit that they were an idiot... But I was an idiot.
I was copying the files in question to the WRONG debug folder.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm trying to correctly write the stream data to control.
Response.Write(stmDetailData = DWGControl);
Full event code:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
Control DWGControl = FindControl("dwgViewerCtrl");
const string sql = "SELECT Detail_ID, Detail_DWG from Detail_Info";
try
{
using (System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["DetailsDBFConnectionString3"].ConnectionString))
cn.Open();
using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT Detail_ID, Detail_DWG from Detail_Info"));
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();
DataSet_Details ds = new DataSet_Details();
da.Fill(ds, "DetailInfo");
int c = ds.Tables["DetailInfo"].Rows.Count;
if (c > 0)
{
Byte[] byteDetailData = new Byte[0];
byteDetailData = (Byte[])(ds.Tables["DetailInfo"].Rows[c - 1]["Detail_dwg"]);
System.IO.MemoryStream stmDetailData = new System.IO.MemoryStream(byteDetailData);
Response.Write(stmDetailData = DWGControl);
}
cn.Close();
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}
|
|
|
|
|
I don't understand your line:
Response.Write(stmDetailData = DWGControl);
I think it should be instead:
Response.ContentType = "application/dwg";
Response.BinaryWrite(stmDetailData.ToArray());
Best regards,
Jaime.
|
|
|
|
|
first thanks for evryone help others in this website
i would like to compare between tow datetime and get the deffrance between them in hours
example
in parking we get the entrance datetime and leave datetime
i want to compare tow datetime and get the real hours of parking
MD_NADA
|
|
|
|
|
TimeSpan ts = dateTime1 - dateTime2;
Console.WriteLine(ts.TotalHours);
|
|
|
|
|
You should look into the TimeSpan object.
TimeSpan timeSpan = DateTime.Now.Subtract(new DateTime(2008, 10, 3));
To get the whole number of hours, its as simple as int hours = timeSpan.Hours
If you want to get the total hours, double totalHours = timeSpan.TotalHours
If you're unclear on any of this I recommend taking a look at the documentation or doing a google search on System.TimeSpan
|
|
|
|
|
Have been trying up an easy program, but now want to try make it more user friendly by maybe playing a song in the background. How can I go about this one.Anyone help please.(C# base).
|
|
|
|
|
It depends on how you want to do it. The simplest way is:
System.Media.SoundPlayer soundPlayer = new System.Media.SoundPlayer();
soundPlayer.SoundLocation = @"c:\chord.wav";
soundPlayer.Play();
Don't forget to call soundPlayer.Dispose() when you're finished with it!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks alot that helped and am able to get through.could have kissed you if you were next to me.(just a jok)
Now check here, that method can only work with .wav file type only? or you can use other files(file size for a wav file is too large).
waiting....
Thanks alot
|
|
|
|