|
|
most barcodescanners act like a keyboard so you won't need anything special.
greets
m@u
|
|
|
|
|
Hello experts,
I have a combo in that I fill some values from Db say A,B,C,D,e,f,G,h,i,j etc.
My combo is a simple combo so end user can also type in that. for data consistency I check wheather or not the user select proper value or not...? That is user have to enter or select the pre-filed value. For that I am using the Contains method
like
comboBox1.Items.Contains(comboBox1.Text.ToString()
and its working fine.
But this will interperete A and a different ....What to do...?
I want a and A are the same
Regards
Pankaj Joshi
|
|
|
|
|
One idea might be to do a string comparison between the objects in the combobox and the the value inserted by the user
for (int i = 0 ; i < cmb.Items.Count ; i++)
{
if (String.Compare(cmb.Items[i].ToString,cmb.Text,true)
{
}
else
{
}
}
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
Thanks for reply
But this is Ok...? If I having 15,000 records in combo then for loop will run 15,000 times and check the item. This will make code slower, And .Contains method automatically do that only case-sensitivity is the matter...I am right?
Regards
Pankaj Joshi
|
|
|
|
|
pankaj.indore wrote: If I having 15,000 records in combo then for loop will run 15,000 times and check the item.
Yes, when you have 15000 records in a combobox it's not right...but then again...why don't you do some filtering to have fewer values...or even...you should try to use autocomplete would work better
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
Hi,
If you have already fill-in all the possible values in that combo, why not you make it un-editable? That way, still, the user will be able to select the value by pressing the 1st character key of the value. Correct me if i am wrong.
Regards,
Adeel
|
|
|
|
|
Hi Adeel,
You are right, But in this case only one letter searching is allowed and
My combo having more than 15,000 records and that will create a problem.
SO user can type first few starting letters of the name and then select the name.
In your case [DropDownList I suppose] you only have one letter search and that will take much time to search particular record.
Regards
Pankaj Joshi
|
|
|
|
|
use like this
bool chkitem_small = comboBox1.Items.Contains(comboBox1.Text.ToLower());
<pre>bool chkitem_cap = comboBox1.Items.Contains(comboBox1.Text.ToUpper());
if(chkitem_small == true | chkitem_cap == true)
{
}
else
{
}
Becoming Programmer...
|
|
|
|
|
That is working fine
Thanks for reply
Regards
Pankaj Joshi
|
|
|
|
|
hi,
Is it posible to use two diferent connection string in a SqlTransaction object??
Be very grateful for any advice.
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Hi,
I dont think it is possible to use two connection strings(CSs) at the same time!! But you should be able to use two different CSs 1 after the other. Like use CS-1 perform something in transaction close CS-1, then open CS-2 and use it with the same transaction object! That may be possible.
Regards,
Adeel
|
|
|
|
|
Thank you very much for your reply..
<br />
using (SqlConnection connection = DbConnection("SerConstr"))<br />
{<br />
using (SqlCommand command =<br />
connection.CreateCommand())<br />
{<br />
SqlTransaction transaction = null;<br />
<br />
try<br />
{<br />
connection.Open();<br />
<br />
transaction = connection.BeginTransaction();<br />
<br />
<br />
<br />
<br />
command.Transaction = transaction;<br />
<br />
<br />
<br />
command.CommandText = "Insert ...";<br />
command.ExecuteNonQuery();<br />
<br />
command.CommandText = "Update...";<br />
command.ExecuteNonQuery();<br />
<br />
transaction.Commit();<br />
}<br />
catch<br />
{<br />
transaction.Rollback();<br />
throw;<br />
}<br />
finally<br />
{<br />
connection.Close();<br />
}<br />
<br />
how I ll do this??
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Vipin.d wrote: // i need to perform this in con1
command.CommandText = "Insert ...";
command.ExecuteNonQuery();
// Execute i need to perform this in con2
command.CommandText = "Update...";
command.ExecuteNonQuery();
The insert and update queries refer to the same database, within the same server?
I will use Google before asking dumb questions
|
|
|
|
|
yes i know that ,
my requirement is I need to change the connection string before doing UPDATE process.is it have any solution??
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Can you please elaborate "Insert..." & "Update..." bit more? Like for what purpose you need to have two CSs? Do you want to change the database? If yes, why not do it as an intermediate SQL statement between insert & update?
|
|
|
|
|
Dear friend,
my rquiremnt is like
1. SELECT some data from servr1.db1.Tbl1
2. INSERT that to server2.db2.Tbl1.
3. UPDATE the status filed of selected data in servr1.db1.Tbl1
If either step 2 or 3 fail I need to Roll back that transaction.
any advice please..
Let me check intermediate SQL statement in my Google Uncle
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
First, allow me to clear this, I used "intermediate" as an english word, not as technical word.
Theoretically, it should be like that
connect with server1
select
if it was a success
connect with server2
insert
if it was a success
disconnect with server2
update
if not success rollback
disconnect with server1
Surely, you will need to have 2 connection objects, given this is not a live server with few hundereds transactions goin on.
Hope that helps!
Adeel
|
|
|
|
|
|
Why do you need 2 connection strings? What is the purpose..changing the database while the transaction is open?
I will use Google before asking dumb questions
|
|
|
|
|
Dear friend,
my rquiremnt is like
1. SELECT some data from servr1.db1.Tbl1
2. INSERT that to server2.db2.Tbl1.
3. UPDATE the status filed of selected data in servr1.db1.Tbl1
If either step 2 or 3 fail I need to Roll back that transaction.
any advice please..
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
The ConnectionString property can be set only when the connection is closed. (from MSDN) and when you close a query, the pending transactions are rolledback.
So...my suggestion is to use at least 2 connections
using (SqlConnection conn = new SqlConnection())
{
string cs1 = "connection string 1";
conn.ConnectionString = cs1;
conn.Open();
SqlTransaction trans = conn.BeginTransaction();
if (InsertSecondDB())
{
trans.Commit();
}
else
{
trans.Rollback();
}
conn.Close();
}
The InsertSecondDB should create a new connection and a new transaction to the second DataBase and return true if the query succeeded or false otherwise.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
defenitely it clicked some ideas in my mind..
Thank you soo much!!
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Dear friends,
During my g0ole search i got this
Distributed Transaction ^]
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
how to synchronize file on two pc
|
|
|
|