Ramy Mahrous 401 Postaholic Featured Poster

Please use Code Tag :)

String connectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];

string Query = String.Format("SELECT RegNo FROM Student WHERE RegNo ='{0}' ", cmbRegNo.Text);

OleDbCommand cmd=new OleDbCommand(Query,new OleDbConnection (connectionString));

int id =(int)cmd.ExecuteScalar();
Ramy Mahrous 401 Postaholic Featured Poster

I don't have any solution expect to send it as parameter (Image path)
http://ramymahrous.wordpress.com/2009/04/20/building-aspnet-reporting-olap-based-application-part-3/

Ramy Mahrous 401 Postaholic Featured Poster

Sure!!
What you trying to do is to convert "SELECT Id FROM Student WHERE RegNo ='value' to Integral value!!
Just tel me what you need to do.
I expect you need to execute this query and take the result in the ID
So

string selectStatement = String.Format("SELECT Id FROM Student WHERE RegNo ='{0}' ", cmbRegNo.Text);
SqlCommand cmd = new SqlCommand(selectStatement, connection);
int id = (int)cmd.ExecuteScalar();
Ramy Mahrous 401 Postaholic Featured Poster

You are welcome, mundetas, Donish
Your questions are welcome :)
Please mark it as solved, mundetas

Ramy Mahrous 401 Postaholic Featured Poster

I'm sorry I couldn't do that, because it needs some improvements in the language itself.

Ramy Mahrous 401 Postaholic Featured Poster

http://refact.blogspot.com/2007/02/effective-implementation-of-cast-128.html

public byte[] EncryptMyData(byte[] plainData, out byte[] encryptionKey)
{
    encryptionKey = Guid.NewGuid().ToByteArray();
    int[] scheduledKey = AcedCast5.ScheduleKey(encryptionKey);
    long iv = AcedCast5.GetOrdinaryIV(scheduledKey);
    byte[] result = (byte[])plainData.Clone();
    AcedCast5.EncryptCBC(scheduledKey, result, 0, result.Length, iv);
    AcedCast5.ClearKey(scheduledKey);
    return result;
}

public byte[] DecryptMyData(byte[] encryptedData, byte[] decryptionKey)
{
    int[] scheduledKey = AcedCast5.ScheduleKey(decryptionKey);
    long iv = AcedCast5.GetOrdinaryIV(scheduledKey);
    byte[] result = (byte[])encryptedData.Clone();
    AcedCast5.DecryptCBC(scheduledKey, result, 0, result.Length, iv);
    AcedCast5.ClearKey(scheduledKey);
    return result;
}

I expected you forgot # in your question and you mean C# not C language.

Ramy Mahrous 401 Postaholic Featured Poster

All my replies were on direction to use Windows-based application.
SURE THE LOGICAL SOLUTION is to use Web-based application (ASP.NET), it's very easy and you'll go through it quickly. Best of luck

Ramy Mahrous 401 Postaholic Featured Poster

The only applicable scenario is everyone (clients) install client application (.exe) and all the functionalities in it; talk directly to webservice which handles requests and responds back to the client.
What you need to know is
Host webservices on domain like any web application.
Talk to webservices from any client application.

All about webservices http://msdn.microsoft.com/en-us/library/ms996507.aspx

Another alternative is to use WCF, I personally recommend it http://msdn.microsoft.com/en-us/netframework/aa663324.aspx

Ramy Mahrous 401 Postaholic Featured Poster

What do you mean with online? Internet or Intranet?

Ramy Mahrous 401 Postaholic Featured Poster

I also gave the solution!!! Back to 2nd reply!

Ramy Mahrous 401 Postaholic Featured Poster

and what this time "26:30Hours" represents?!!!

Ramy Mahrous 401 Postaholic Featured Poster

You need to press a button on web form to close a window in windows-based application?

Ramy Mahrous 401 Postaholic Featured Poster

Yes!

Ramy Mahrous 401 Postaholic Featured Poster

Good, please mention your SELECT statement.

Ramy Mahrous 401 Postaholic Featured Poster

Please just remind me if I didn't send it to you after 1 AM GMT

Ramy Mahrous 401 Postaholic Featured Poster

What do you need exactly?

Ramy Mahrous 401 Postaholic Featured Poster

Just wait to tomorrow and I'll attach this thread with dll you can add it as reference and work with generics in your vs 2003 I hope this workaround works

Ramy Mahrous 401 Postaholic Featured Poster

So, follow Serkan and post the whole code here.

Ramy Mahrous 401 Postaholic Featured Poster

look, in .net framework 2.0 they are just classes no more no less, and reflector can extract C# code from assemblies.

Ramy Mahrous 401 Postaholic Featured Poster

If you bind data source to ComboBox well,

CAMPAIGN_ID = int.Parse(cboxMailRespSelProgram.SelectedValue.ToString());
Ramy Mahrous 401 Postaholic Featured Poster

I can send you the generics implementation in VS 2005 or you can extract it from reflector :)

Ramy Mahrous 401 Postaholic Featured Poster

You can either construct SELECT statement to do the calculation or override GridView DataBound event handler to perform the calculation, please mention are you working in web-based\windows-based application?

Ramy Mahrous 401 Postaholic Featured Poster

Serkan always overrides technical thread to personal one, really if you are banned I'll upset not having you around, but still I'll be sure there are no more replies in threads :D

Ramy Mahrous 401 Postaholic Featured Poster

ex.InnerException and plus you didn't show the error because you are working on Windows-based application
modify your catch block to

catch (Exception ex)
{
// Display any exceptions
//Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
MessageBox.Show(ex.InnerException);
//MessageBox.Show("Transaction Failed");
// If anything failed after the connection was opened, roll back the transaction
if (txn != null)
{
txn.Rollback();
}
}
Blaine Tuisee commented: Gave me the tool, the exception message, that allowed me to find the issue +2
Ramy Mahrous 401 Postaholic Featured Poster
class MyTreeNode : TreeNode
{
//your properties
}
Ramy Mahrous 401 Postaholic Featured Poster

You can set the ToolTip of the node to these information or you can set the node text = "Folder name - Folder size"

Ramy Mahrous 401 Postaholic Featured Poster

You can't disable it. "you can't" == you can but after huge efforts. what does this sound means to you?! it means you haven't accept button on your forum, once you've this button you won't get this sound + TextBox class not getting this sound itself, but OS does.

Ramy Mahrous 401 Postaholic Featured Poster

Please clarify more, or figure on paper what you need exactly

Ramy Mahrous 401 Postaholic Featured Poster

You made me lost!!! <MediaElement source ="filePath"> it doesn't need anything from memory, I expected you need some binary representation to your file!!!!
http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.source.aspx

Ramy Mahrous 401 Postaholic Featured Poster

In later versions, no method called SetDataBinding

else
            {

                this.dataGridView.DataSource = ds;
                this.dataGridView.DataBind();
                          

            }

I don't know actually, it's called dataGridView or gridView or what but me and I refer to VS grid.

Ramy Mahrous 401 Postaholic Featured Poster

OK, I just asked you because I expected you need just to play a song from your application without interacting with Media Player or if you need to play a song file without any information about the software user uses.

So, to convert any file to its binary representative

System.IO.FileStream fs = new System.IO.FileStream(@"FilePath", System.IO.FileMode.Open);
byte[] fileAsBytes = new byte[fs.Length];
fs.Read(fileAsBytes, 0, fileAsBytes.Length);
fs.Close();

To convert it back to stream

System.IO.StreamReader sr =  new System.IO.StreamReader(new System.IO.MemoryStream(fileAsBytes));
Ramy Mahrous 401 Postaholic Featured Poster

Thank you Cman :)
Thank you too Serkan :)
All what you need, Cman is to identify sqlDataAdapter, and sqlConnection as global variables <- WHY?!
Because at VS 2003 days, those were components like OpenFileDialog and SaveFileDialog and they were identified globally but they (VS team at MSFT) enhanced ADO.NET architecture and removed those components and they became native classes
so modify your code to

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WorkEasy1
{
    public partial class Form2 : Form
    {
#region Global Variables
SqlConnection sqlConnection = new SqlConnection("Your Connection String");
SqlDataAdapter sqlDataAdapter;
#endregion
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            string select = "SELECT * FROM ClientDB";

            DataSet ds = new DataSet();

            this.sqlConnection.Open();

            this.sqlDataAdapter = new SqlDataAdapter(select, sqlConnection1);

            this.sqlDataAdapter.Fill(ds, "ClientDB");

            if (ds.Tables["ClientDB"].Rows.Count == 0)
            {

                MessageBox.Show("There are no DB.");

            }

            else
            {

                this.dataGrid.SetDataBinding(ds, "ClientDB");

            }

            this.sqlConnection.Close();
        }
    }
}
Ramy Mahrous 401 Postaholic Featured Poster

In your case use DataGrid, it's most suitable to your case.

Ramy Mahrous 401 Postaholic Featured Poster

Something far away your question but I need to share it with you.
Show the toolbox IFF (if and only if) you need it, because every switch from document to document i.e aspx to aspx.cs to .asmx VS initializes the toolbox (and it slows down the VS) close it and when you need it open it Ctr (X + W)

Ramy Mahrous 401 Postaholic Featured Poster

Are you using SQL Server? You can post your question to PHP forum as I don't know where your problem exists?!

Ramy Mahrous 401 Postaholic Featured Poster

You need to play it?!

Ramy Mahrous 401 Postaholic Featured Poster

Again, a database is your solution. XML and directory but users can delete\replace or play with directory which then your assembly well not behave well.

Ramy Mahrous 401 Postaholic Featured Poster

Update statement:
You should send the ID and the Value be deduction from the existing quantity

Update Table 
Set Quantity = Quantity - @Value 
Where ID=@ID
Ramy Mahrous 401 Postaholic Featured Poster

You're welcome, Add to Ramy Mahrous's Reputation, then I approve and put your comment :)
Please mark this thread as solved.

Ramy Mahrous 401 Postaholic Featured Poster

hmmm, where is the question? I don't know in what you have problem.

Ramy Mahrous 401 Postaholic Featured Poster
System.IO.File.AppendAllText(filePath, content);

In your case

System.IO.File.AppendAllText(@"c:\TestFile.txt", txtOutput.Text);
Ramy Mahrous 401 Postaholic Featured Poster

Create table for words
#ID Word

Create table for descriptions
#ID description

Create bridge table for words\descriptions
#WID #DID

Query them you can get anything you need like
* All words have specific description(s)
* Count of words have specific description(s)
etc...

Ramy Mahrous 401 Postaholic Featured Poster

Thank you very much, Susan, for this valuable information :)

Ramy Mahrous 401 Postaholic Featured Poster

Serkan you really made me laugh, you are extraordinary person, thinks in things in strange way.....
Anyway, you should mention the problem and how you solved it.

Ramy Mahrous 401 Postaholic Featured Poster

I have to remove the hyphen in order to make it a string

Everything is string, with\out hyphen it's string but if you don't need the hyphen, you can replace it with null str = str.Replace("-",null); or if you've set of characters you need to remove

char[] UnneededCharacters = new char[] {'-','*','@','&'}; 
string str = "123-456*789@abc&def";
str = str.Trim(UnneededCharacters);
//str = 123456789abcdef

But, there no need to your string.IsNullOrEmpty(...) EXCEPT you may have returned string like that "-"

Ramy Mahrous 401 Postaholic Featured Poster

It's very hard and unscalable. you should do what I said in the first reply.

Ramy Mahrous 401 Postaholic Featured Poster

What's the type of application?!

Ramy Mahrous 401 Postaholic Featured Poster

You're welcome, please mark it as solved.

Ramy Mahrous 401 Postaholic Featured Poster

Look, I don't know why you used Trim with String.IsNullOrEmpty. But yes my code will remove it. I expected you need to remove it because the string not formatted.

Ramy Mahrous 401 Postaholic Featured Poster