|
Thanks Cassandra:
I previously wasn't able to get the syntax to do what I needed to do.
I just kept dancing around the issue in code, but couldn't quite get it right.
That took care of it.
Thanks for responding.
Richard
|
|
|
|
|
hi,
I have this problem which I have been trying to solve for some time but with no result
I have a table in sql server which consists of two columns: LastName and First name, and a result for a "select * from TestTable" is:
Doe John
NULL Mark
Then a I have a piece of code in my WinForms application:
string connString = "server=.;database=Test;Integrated Security=SSPI;";
string sql = "select LastName, FirstName from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
DataTable dt = dataset1.Tables["TestTable"];
listBox1.DataSource = dt;
if (listBox1.DisplayMember.Length != 0)
{
listBox1.DisplayMember = "LastName";
}
else
{
listBox1.DisplayMember = "FirstName";
}
textBox1.DataBindings.Add("text", dt, "LastName");
textBox2.DataBindings.Add("text", dt, "FirstName");
and it works fine, when there is a NULL value in teh LastName column, in the listBox the FirstName is diplayed. The binding works ok
Now when I alter the table and add another column (Company), the same sql query result looks like that:
Doe John NULL
Smith Mark NULL
NULL NULL Microsoft
Now when I make changes to the code to looke like this:
string connString = "server=.;database=Test;Integrated Security=SSPI;";
string sql = "select LastName, FirstName, Company from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
DataTable dt = dataset1.Tables["TestTable"];
listBox1.DataSource = dt;
if (listBox1.DisplayMember.Length != 0)
{
listBox1.DisplayMember = "LastName";
}
else
{
listBox1.DisplayMember = "Company";
}
textBox1.DataBindings.Add("text", dt, "LastName");
textBox2.DataBindings.Add("text", dt, "FirstName");
textBox3.DataBindings.Add("text", dt, "Company");
in the listBox I only get the Microsoft entry. The other entries are there but are not visible by the LastName but blank, the binding still works.
http://img103.imageshack.us/my.php?image=50493721ap6.jpg
http://img397.imageshack.us/my.php?image=83000105po0.jpg
Can some help to solve this?
|
|
|
|
|
Since you've binded the listBox1.DisplayMember to company name, it's quite obvious that the first two rows will show nothing since the company is null. What kind of result would you expect?
|
|
|
|
|
so what solution would suggest?
|
|
|
|
|
That depends what do you want to show in the list box? Now you've defined to show only the company name. If there isn't any, nothing is shown.
For example, do you want to show a combined string in the list box? Something like:
Doe, John, Unknown
Smith, Mark, Unknown
Unknown, Unknown, Microsoft
|
|
|
|
|
no, I just want to show a list of LastNames from the table, and if there is a NULL value for the LastName column in a given row then show for that row the value from the column Company
|
|
|
|
|
Okay, then you have at least two options. You can modify your SQL statement and create an additional column and bind to it, like (there may be typos in the examples):
string sql = "select LastName, FirstName, Company, <code>COALESCE(LastName, Company) AS ListData </code>"
+ "from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
listBox1.DataSource = dataset1.Tables["TestTable"];
listBox1.DisplayMember = "<code>ListData</code>";
or after filling the dataset, you can create a computed column:
string sql = "select LastName, FirstName, Company "
+ "from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
<code>dataset1.Tables["TestTable"].Columns.Add("ListData",
typeof(string),
"ISNULL(LastName,Company)");</code>
listBox1.DataSource = dataset1.Tables["TestTable"];
listBox1.DisplayMember = "ListData";
Hope it helps.
|
|
|
|
|
the second solution works like a charm many thanks
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi,
I need the output of date time as DateTime format
"s" which means dd-MM-yyTHH:mm:ss using XDate of ZedGraph.
my code is s follow:
double x = (double)new XDate(yearData, monthData, dayData, hourData, minData, secData);
Then write AxisType.Date;
I am getting dd-MM-yy correctly, but HH:mm:ss as 00:00:00.
Can anyone please help to write a correct code to get the
required output?
Thanks.
|
|
|
|
|
|
Hi All,
I am looking for code written in .NET that provides connection between application and telephone.
So that - the telephone will return a code according to input code that it get's from the user.
I'll be happy to get even a little help - if you know something that relate and can help me!!
Thanks.
|
|
|
|
|
TAPI, TAPI, He's your man!
If TAPI can't do it, no one can!
"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
|
|
|
|
|
Wow, that was truly poetic
modified 12-Sep-18 21:01pm.
|
|
|
|
|
as Jhon told you TAPI is the only way.
you can download c# wrappers here[^]
or you can use windows dll like this[^].
|
|
|
|
|
Thank you!
I would be happy to get more specipic help - about getting back answer from the telephone (and not dialinig to the talaphone from the computer).
Thanks again!
|
|
|
|
|
in the link u got, were the code here:
The code below is responsible for registering incoming calls so that they can be handled by our application. For that you need to select the line on which you want to receive calls and press the Register button.
Collapse Copy Code
try
{
registertoken[line]=tobj.RegisterCallNotifications(ia[line],
true,true,TapiConstants.TAPIMEDIATYPE_AUDIO,2);
MessageBox.Show("Registration token : "+
registertoken[line],
"Registration Succeed for line "+line);
}
catch(Exception ein)
{
MessageBox.Show("Failed to register on line "+line,"Registration for calls");
} The class given below is to be added depending upon your TAPI event handling requirements. This is specially designed according to the requirements of the application.
please read the article!!
|
|
|
|
|
I have no help
only DASH HAM!
|
|
|
|
|
In Visual C# if I force a recompile of unchanged source code the resulting executable are not the same. Can anyone define where they should be different and why or provide a tool that will indicate if two exe files came from the same source code?
Thanks,
Curt
|
|
|
|
|
Most likely they are different due to changes in the assembly metadata, like the file version and/or assembly version. How are you determining the files are not the same?
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
I used HexEdit to compare the files. In one case the difference was from:
{231F082C-31A4-4DF7-A34E-9B7383E240FD}
to:
{20EFE830-6E58-4A20-B725-F263FA47C142}
which looks like a regenerated version but in other cases the differences were just a few "random" bytes.
My customer expects to being able to confirm a certain set of files was used to create a executable by comparing the executable created at another time. Is there another way to confirm this?
|
|
|
|
|
As Luc said, it really isn't possible to do a binary comparison on a file and tell what changed about them. The best you can hope for is that you can tell the file didn't change.
The only way to recompile and have the resulting binary be the same is to ensure that absolutely nothing in the source code changes, including things like version stamps, etc.
It isn't clear what your customers real expectation is and why they want this ability. A good source control system and build process will ensure that you can recreate an executable from the same source each time.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
My customer has a medical device background (safety critical, high process) and I must PROVE the build process, especially when re-created on another machine, results in the same executable. Unfortunately, have good process isn't enough.
|
|
|
|
|
Hmmm...for the most part having a repeatable process has to be good enough. That is the basis for CMM certifications. Would computing a CRC or some other type of checksum on the files and comparing that checksum be enough?
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Considering there are plenty of situations where COM-exposed GUID are generated on every compile, and never the same between compiles, and between machines, you can't compare the two and come up with the exact same binary.
|
|
|
|
|