w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can use I SqlCommand with a where clause in textbox?
With your current Implementation, you need to enter complete Select Query with Where clause in your TextBox Control: txtCommand, since you are reading the whole text of the textCommand into the select string which forms the SelectQuery . One better way is to enter only the value to used in Where into your text box and append it to your actual SQLSelect Query: string select= "Select * from test where ID=" + "'" +txtCommand.Text+ "'"; Note that the above simple way exposes a lots of ways for SQL Injection attacks. So use this example just for startup and then implement your different ways for security.

Categories : Asp Net

SQL:in clause with query taking too long compared to in clause with actual data
Actually, MySQL execute the inner query at the end, it scans every indexes before. MySQL rewrites the subquery in order to make the inner query fully dependent of the outer one. For exemple, it select * from student (depend of your database, but could return many results), then apply the inner query user_id=4 to the previous result. The dev team are working on this problem and it should be "solved" in the 6.0 http://dev.mysql.com/doc/refman/5.5/en/optimizing-subqueries.html EDIT: In your case, you should use a JOIN method.

Categories : Mysql

unequal columns in two different select clause used union clause
Hopefully, I have understood you. If you wish to extract data from two tables, they dont need to have identical numbers of columns, but they DO need to have something in common. The generic sytnax would be: SELECT table1.col1, table2.col1 FROM table1 LEFT JOIN table2 ON table1.col3=table2.col3 WHERE {where conditions} What is important here is that there is a linking bit of data - often a usernumber that is common to both tables and means the same thing in both tables.

Categories : Mysql

TSQL OVER CLAUSE That has no partition by has Order By clause
First one is not working for me (returning Msg 8120 Column 'Salaries.employeeID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause), until I add group by employeeID: SELECT employeeID as ID, RANK() OVER (ORDER BY AVG (Salary) DESC) AS Value FROM Salaries GROUP BY employeeID Perhaps, for better understanding, it can be rewritten equivalently as: ;with cte as ( SELECT employeeID, AVG (Salary) as AvgSalary FROM Salaries GROUP BY employeeID ) select employeeID as ID , RANK() OVER (ORDER BY AvgSalary DESC) as Value --, AvgSalary from cte In this case, average salary by employee is calculated in the CTE, and then query is extended with ranking column Value. Adding partition by employeeID to over cl

Categories : Sql Server

MySQL index in between where clause and order by clause
Your key problem is that over 950k rows your status column has up to 4 distinct values. On a BTREE index, this will be a real pain to process. Some more effective indexes to use for the 3 queries mentioned are probably the following INDEX forQuery1 ( field_1 , status , rank ) USING BTREE, INDEX forQuery2 ( field_2 , status , rank ) USING BTREE, INDEX forQuery3 ( field_5 , status , rank ) USING BTREE, You'll find that the second query especially should benefit however you're still going to have the issue where the variance of the data is very low for the size of dataset and most likely MySQL will fall back to a table scan though your EXPLAIN will probably show the LIMIT to lessen the effect of that. The indexes mentioned should be suitable for determining which rows to return though.

Categories : Mysql

Join Subquery in FROM clause aliased in WHERE clause
Try something like : SELECT MainTable.ID,MainTable.DETAILS,MainTable.ENTRYDATE,ISNULL(MainTable.LastBalance, 0) + ( SUM(subMainTable.VAL)) AS Balance FROM ( SELECT MainTable.* FROM tempData MainTable LEFT JOIN FinanceTable FinTable ON (MainTable.ID = FinTable.accId AND MainTable.TRANS_ID = FinTable.txnID ) WHERE (FinTable.accId IS NULL AND FinTable.txnID IS NULL ) ) AS MainTable left outer join ( SELECT TRANS_ID ,ID , SUM(VAL) FROM tempData subMainTable LEFT OUTER JOIN FinanceTable f ON subMainTable.ID = f.accId AND subMainTable.TRANS_ID = f.txnID WHERE f.txnID IS NULL ) as subMainTable on subMainTable.TRANS_ID <= MainTable.TRANS_ID AND subMainTable.ID = MainTable.ID group by MainTable.ID,MainTable.DETAILS,MainTab

Categories : SQL

Improving a LIKE clause through static clause elements
You can use EXPLAIN to know which query is faster. As a general concept it is better to have static queries than LIKE queries. So it gets faster if you add some. But only if it actually reduces the rows for the LIKE and the static query uses and index. The principle is that a LIKE style query (together with other queries that have to scan through the content of the field) is expensive. (see the cost column in the EXPLAIN) So, if you reduce the amount of rows that need to be treated for a LIKE the query gets faster. What exactly makes what query fast under what circumstances is hard to answer generally. You should ask precise questions to them including a description of your concrete situation (DBMS, table model, indexes, amount of data, result of an EXPLAIN call, etc.) to get working a

Categories : Mysql

jQuery textbox change event doesn't fire until textbox loses focus?
Try this: $("#textbox").bind('paste',function() {alert("Change detected!");}); [FIDDLE DEMO] -- > http://jsfiddle.net/K682b/3/

Categories : Jquery

How to populate records to textbox & display part of that record in textbox using autocompleteextender.
Here is a great article on the subject http://www.codeproject.com/KB/ajax/autosuggestextender.aspx A follow-up article explaining how to call an asynchronous server side auto post back event on a user's selection: http://www.codeproject.com/KB/webforms/PostbackAutoCompleteExten.aspx

Categories : C#

How to create method like Html.TextBox that adds attributes to textbox rendered?
Add the attribute data_abc to the optional parameters and it will add it as data-abc. @Html.TextBox("Name", "Default Value", new { data_abc = "data" }); Good luck!

Categories : Asp Net Mvc

Insert command with where clause and like clause
WHERE only applies to SELECT, UPDATE and DELETE. An INSERT creates a new record, using WHERE doesn't make any sense if there's nothing yet.

Categories : SQL

Why TextBox property MaxLength is not working for a customised TextBox?
You can specify input scope only for TextBox. The reason behind the not availability of this feature for passwordbox is that The input scope gives the clear idea about the character type. Hence hacker can easily identify that your password consist of only numeric and that makes him to know your password easily.

Categories : Misc

Transfer the Winform Textbox data to Html Textbox
Just paste the all the code I just add function SendTextToActiveElementWithSubmitOptionSet(bool btnSubmit) I solve my issue below my code private void SendTextToActiveElementWithSubmitOptionSet(bool btnSubmit) { mshtml.IHTMLDocument2 document = null; document = TargetIE.Document as mshtml.IHTMLDocument2; if (!document.activeElement.isTextEdit) { MessageBox.Show("Active element is not a text-input system"); } else { HTMLInputElement HTMLI; HTMLI = document.activeElement as HTMLInputElement; var tag = HTMLI.document as mshtml.HTMLDocumentClass; mshtml.IHTMLElementCollection hTMLElementCollection = tag.getElementsByT

Categories : C#

call textbox[i] from textbox array created by hand before
This is expected behavior. Dynamically added controls are lost after postback. Normally you will keep those control's information in Session or viewstate and rebuild those controls after postback. Page_Load is a good place to rebuild them. You will find many articles on how to persist the controls as well as their data, just search with "asp.net dynamically added controls are lost at postback". Here's an example you can look at:How to retain values of dynamically created controls in asp.net. Here's another exmple: Re: Dynamic Controls in Placeholder lossed after postback. Hope it helps!

Categories : C#

Textbox value in other textbox by clicking button not correct
As pointed out in the comments, the Text property of the TextBox needed to be used: txt_FinishLink.Text = txt_Site.Text + "utm_source=" + txt_Website.Text + "_" + txt_Page.Text + "_de&utm_medium=banner&utm_campaign=" + txt_Campaign.Text + "&utm_content=" + txt_Format.Text Text will return the string of characters in the specified TextBox.

Categories : C#

how to clear textbox value on other textbox focus in jquery?
if(!checkDate($("#txtDate").val())) { $("#txtDate").val(""); $('#txtDate').focus(); } you forgot # on this $("txtDate").val()

Categories : Jquery

KnockoutJS check if on textbox is greater than another textbox
An extender wraps an observable. Are you setting the value of model.tbLow to the result of the observable.extend() function? Your code should look like this: self.model.tbLow = self.model.tbLow.extend({ ... }); Or if you extend it from within your model... this.tbLow = ko.observable(...).extend({ ... }); Did you write that validation extender yourself or are you using something you found? Can you post or link to the code for that? Otherwise we don't know if you're using it properly, we can't know what the 'greaterThan' function is being sent.

Categories : Knockout Js

copy first three letters of some textbox and paste to another textbox
This should do the job : Private Sub textbox2_GotFocus() Dim length As Integer length = Len(textbox1.Text) If length > 3 Then length = 3 textbox2.Text = Left$(textbox1.Text, length) End Sub The GotFocus event will trigger if you click on the textbox or if you use tab key.

Categories : Misc

Onfocus of textbox clear other textbox in the same row in razor
Working Demo http://jsfiddle.net/cse_tushar/7NLa8/1 $('table tr td input[type="text"]').focus(function () { $(this).parent().parent().find('input[type="text"]').not(this).val(''); });

Categories : Jquery

how to take out an existing textbox value and add it with other value and display the output in the same textbox
I think you have a variable out of scope, but hard to tell exactly without all of your code. Where is the variable bill declared? You also need to parse the mbill variable so it doesn't get treated as text. Is this what you're after? <input class=cal type=text /><br /> <input class=cal type=text /><br /> <br /><br /> <input id=numtoadd type=text value=10 /><br /> var mbill = parseFloat($("#numtoadd").val()); $(".cal").keyup(function(){ var bill = 0; $(".cal").each(function(){ if (!isNaN($(this).val()) && $(this).val().length != 0) { bill += parseFloat($(this).val()); } }); $("#numtoadd").val(mbill + bill); }); Updated fiddle: http://jsfiddle.net/MTgpN/2/

Categories : Jquery

how to change value of textbox based on another textbox in wpf datagrid
I'm not really getting the question but as I see it you either want: a. To assign a default value to the readonly textbox which is simple, you just assign a 'Name' in xaml and then use it in code or b. You want to use the data that is stored in the readonly textbox which is done again by assigning a 'Name' in xaml and then use it in code.

Categories : C#

Inserting a textbox (percentage sign) in the gridview that allow user to enter a percentage in the textbox, then populating the cells at the botton
What will you do with 3 rows of percentage textboxes?What does each row of percentage textbox take the percentage of?Is it the percentage of the sum of all the numbers above?Then why do you need 2 more rows filled with percentage textboxes? I understand you want to add dynamic code because the number of rows from stored procedure may change everytime.I have simplified your code: private void AssignCellCoordinatesIndividual(GridView gv) { // Create IDs for Grid for (int i = 0; i < gv.Rows.Count; i++) { gv.Rows[i].ID = "r" + i; // Row ID for (int ii = 0; ii < gv.Rows[i].Cells.Count; ii++) { gv.Rows[i].Cells[ii].ID = "c" + ii; // Cell ID int RowCount=gv.Rows.Count; if ((in

Categories : Asp Net

dynamic textbox are not store in the textbox
createTextbox is not explicitly available. You'll have to get it by using document.getElementById. Like this... var createTextbox = document.getElementById("createTextbox"); createTextbox.innerHTML = createTextbox.innerHTML +"<br><input type='text' name='mytext' >";

Categories : PHP

How to get value from one textbox and assign to next coming textbox
I would recommend creating an ID for each of the textboxes and then creating the code onkeyup to update the next field. I assume myvar is part of a while loop. I would create an int that goes up for each cycle through the loop and then create an ID based on that number. Example: <div class="entry-edit"> <div class="entry-edit-head"> <h4 class="icon-head"><?php echo Mage::helper('mymodule')->__($value['label']." (".$std['name'].")") ?></h4> </div> <div> <div id="addanswer_form" class="fieldset"> <?php $results = $read->fetchAll("select * from mytable where standards_id =".$std['standards_id']); $looped = 0; foreach($results as $mykey=>$myvar) { ?> <div class="hor-scroll" style=" margin-bottom: 2px; ">

Categories : Javascript

Copy Textbox Contents to Other Textbox
Couple of things; your Fiddle wasn't running the jQuery because it wasn't queued - just add it in the Frameworks & Extensions section to the left. Wrapped in a $(document).ready(function() { }), your jQuery will now run. I believe I understood your question correctly; when the TOTAL_SET_OF_VALUES Scale is set to 3, you want the monitor that row's Source and set the other fields with the same class to the new value on.change(). Fiddle with my solution here.

Categories : Jquery

Textbox value to php variable on textbox value change
You need to make AJAX call. Following is the explained code ajax_call.php <html> <head> <script type="text/javascript"> //function which is called as soon as a user types a single character function update() { //Step 1:create XMLHttpRequest object to make AJAX call. try{ //for firefox,chrome and opera. xmlHttp=new XMLHttpRequest(); }catch(e){ try{ //for IE xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e2){ //Otherwise, notify browser doesn't support ajax. alert('Sorry ! AJAX not supported'); } } //create a handler function to handle the response xmlHttp.onreadystatechange=function(){ //execute the code only when response is successfull //readyState

Categories : PHP

Update a textbox whenever another textbox is Updated
This should work for you private void Form() { txtFirstName.TextChanged += TextBoxChanged; txtLastName.TextChanged += TextBoxChanged; } private void TextBoxChanged(object sender, EventArgs e) { txtFullName.Text = txtFirstName.Text + " " + txtLastName.Text; }

Categories : C#

How to use @Html.TextBox as autocomplete textbox?
Use jQuery autocomplete plugin described http://jqueryui.com/autocomplete/ This sample gets the autocomplete suggestions via JSON from serer. Implement Controller and Action to return JSON and query the database for suggestions. Usually i have UtilitiesController for this kind of Actions, i also recommend writing an extension method for creating AutoCompleteBox, then you can use it @Html.AutoCompleteboxFor(...

Categories : HTML

How to make Search hint textbox background same as textbox background
Well for what you're trying you can bind the Width of the control in the VisualBrush to your actual target's ActualWidth something like: <VisualBrush x:Key="SearchHint" Stretch="None"> <VisualBrush.Visual> <TextBox Background="White" FontStyle="Italic" Foreground="Gray" Width="{Binding ElementName=tb, Path=ActualWidth}" Height="{Binding ElementName=tb, Path=ActualHeight}" Text="Enter search text…" /> </VisualBrush.Visual> </VisualBrush> ... <TextBox Grid.Column="4" Height="22" TextChanged="textboxsearch_TextChanged" x:Name="tb" Margin="0,0,10,10"> <TextBox.Style> <Style TargetType="TextBox"> <

Categories : Wpf

I have two windows forms and when i pressed TAB, the cursor in the form 1 textbox should be placed in form2 textbox.Form1 and form 2 are side by side
Here is a solution: //This form contains textBox1 public class Form1 : Form { public Form1(){ InitializeComponent(); } protected override bool ProcessTabKey(bool forward){ if(textBox1.Focused) form2.FocusText(); base.ProcessTabKey(forward); } Form2 form2 = new Form2(); } //This form contains textBox2 public class Form2 : Form { public Form2(){ InitializeComponent(); } public void FocusText(){ textBox2.Focus(); } } It's not a complete solution but can help you understand the basic mechanism to change the code meeting your requirement.

Categories : C#

how to Clear the values of Telerik Masked TextBox Via Jquery when users clicks on that Telerik Masked TextBox
Please try with the below code snippet. JS function myclick() { var txt = $find("<%= RadMaskedTextBox1.ClientID %>"); txt.set_value(''); return false; } ASPX <telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Mask="(###) ###-####-####"> </telerik:RadMaskedTextBox> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return myclick();" /> Please use "set_value()" to clear/set the value.

Categories : Jquery

WPF - Change Textbox value according to another Textbox value
The basic idea is to connect Name and Age through a Person Property. In Name's setter, you search the person based on the name, if the result is not null, then assign it to Person. In Person's setter, set Age and notify UI. Code is like: private Person _selectedPerson; public Person SelectedPerson { get { return _selectedPerson; } set { if (value == null) return; _selectedPerson = value; PersonAge = _selectedPerson.Age; OnPropertyChanged("Person"); } } private string _personName; public string PersonName { get { return _personName; } set { _personName = value; var person = Persons.FirstOrDefault(item => item.Name

Categories : Wpf

How to update value of a textbox when the value of another textbox changes.
if you use jQuery... var ids = []; $('input[type=text]').each(function() { ids.push($(this).attr('id')); }); ids is now an array of all the ids of the inputs that have the type of text

Categories : Javascript

Not binding data from one window's Textbox to another window's Textbox
When running your app, do you see any Binding Errors in your debug output window? I am not seeing where you are setting your DataContext for your CheckAddressWindow. I think you cut off the top of your XAML for that file. Another problem may be that the "Person" object you are binding to in your CheckAddressWindow is not the same "Person" object being used by the MainWindow. I would recommend that you have a Model that contains a Person object that both the MainWindow and the CheckAddressWindow bind to. This way, both windows are referring to the same person. For info and tutorials on MVVM architecture for WPF, see the following link: MVVM: Tutorial from start to finish?

Categories : Wpf

how to copy data from a textbox in a for loop to another textbox within the for loop
Change the JS to: function copy(val) { for(var i=0; i<val; i++) { var a = document.getElementById("textA"+i).value; document.getElementById("textB"+i).value = a; } }

Categories : Javascript

conversion of xaml textbox code to c# textbox code?
You can simply drag and drop from toolbox. However, You can do it like this via code. System.Windows.Forms.TextBox txt1 = = new System.Windows.Forms.TextBox(); txt1.Location = new System.Drawing.Point(78, 183); this.txt1.MaxLength = 3; this.txt1.Multiline = true; this.txt1.Name = "txt1"; this.txt1.Size = new System.Drawing.Size(130, 72); this.txt1.TabIndex = 2; this.Controls.Add(this.txt1); Now InputScope = Number There are couple of ways here. You can use MaskedTextBox or you can restrict user by validating his input. First one is the preferred. System.Windows.Forms.MaskedTextBox txt1= new System.Windows.Forms.MaskedTextBox(); this.txt1.Location = new System.Drawing.Point(149, 141); this.txt1.Mask = "000"; this.txt1.Name = "txt1"; this.txt1.Size = new System.Drawing.Size(100, 20); th

Categories : C#

How do i write from textBox the text to text file and read back from the file to the textBox?
No need for a StreamWriter or StreamReader, too much clutter and boilerplate. I would suggest txtSettings.Text = System.IO.File.ReadAllText(path_to_file); and on the Leave or Validated event from the textbox System.IO.File.WriteAllText(path_to_file, txtSettings.Text); Don't write to a file on each TextChanged event, or it will write to the file on each keystroke which would prove to be a major bottleneck. Either write to the file on Leave or (Form_Closed if it's in a dialog) or use a Timer to periodically save to the file (and keep track of changes with a boolean that you set to true in the TextChanged event).

Categories : C#

C# WPF Combobox with textbox as element set width of textbox as width of combobox
Try to add the following to stretch the TextBoxes inside the ComboBoxItems: <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> </Style> </ComboBox.ItemContainerStyle>

Categories : C#

Using [like] like in clause in SQL?
Try this one - Query: SELECT * FROM A WHERE EXISTS( SELECT 1 FROM B WHERE b_desc LIKE '%' + a_desc + '%' ) Output: id a_desc ----------- ---------- 2 hp 3 IBM Execution plan: Extended statistics: Update: SELECT A.*, B.* FROM A OUTER APPLY ( SELECT * FROM B WHERE b_desc LIKE '%' + a_desc + '%' ) B WHERE b_desc IS NOT NULL

Categories : SQL

PDO clause where using for
Change your function like this: public function check_siswa($noInduk) { $cnoInduk = count($noInduk); // error to hold the keys that are duplicate $error = Array(); for($i = 0; $i < $cnoInduk; $i++) { $sql = "SELECT no_induk FROM siswa WHERE no_induk = :noInduk"; $q = $this->db->conn_id->prepare($sql); $q->bindParam(':noInduk', $noInduk[$i], PDO::PARAM_INT); $q->execute(); if ($q->rowCount() > 0){ // if the key already exists then add it to the // error array $error[] = $noInduk[$i]; } } // there are some keys that exist already if (!empty($error)){ return $error; } // no duplicates return false else { return false; } } then for

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.