Answered by:
Asp..Net Ajax Autocomplete

Question
-
User197255166 posted
Hello friends I have a problem. I take clients through TextBox AutoComplete Ajax. But here when I want also want to attract customers, also that which users belong to this customer. How is this possible. I share code. Can anyone help me please.
Here I get data with inner join.
string sql = string.Format("SELECT Title,Name FROM Customer LEFT JOIN User As T3 ON T3.Id = Customer.IdSaler
WHERE Title like '%{0}%' Order BY Title LIMIT 10", text);Here is Html Page Ajax Code
<script> $(function () { $("#txtCustomer").autocomplete({ minLength: 3, source: function (request, response) { $.ajax({ url: "API.ashx", data: 'Token=GetCustomersForAutoComplete&Param1=' + request.term, dataType: "json", success: function (data) { response(data); } }); }, select: function (event, ui) { $("#txtCustomer").val(ui.item.Title); $("#hdnCustomer").val(ui.item.CustomerId); return false; } }).autocomplete("instance")._renderItem = function (ul, item) { return $("<li>").append(item.Title + "-" + item.Name).appendTo(ul); }; }); </script>
Sunday, May 22, 2016 1:13 PM
Answers
-
User1724605321 posted
Hi Aliyilmaz,
So your question is how to get data with inner join in ado.net ? ADO.NET runs straight SQL queries. try to below sql query :
SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name; or: SELECT column_name(s) FROM table1 JOIN table2 ON table1.column_name=table2.column_name;
You could try your query in SSMS to check whether it is correct .
Best Regards,
Nan Yu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 31, 2016 2:52 AM
All replies
-
User1724605321 posted
Hi Aliyilmaz ,
Please refer to below article for how to populate jQuery AutoComplete textbox from Database using Web Service in ASP.Net :
Or using AJAX AutoComplete Extender :
http://www.dotnetfox.com/articles/ajax-autocomplete-example-with-database-in-Asp-Net-1079.aspx
Best Regards,
Nan Yu
Monday, May 23, 2016 7:41 AM -
User1050679493 posted
Hi have a look of the below link this may help you
http://www.aspdotnet-pools.com/2014/06/autocomplete-textbox-in-aspnet-with.html
Monday, May 23, 2016 8:51 AM -
User197255166 posted
Thank you but your sent example only one get data. at the same example I did. But I want to do with inner join get data.
For example Company Name - Saler Name. I shared my code.
string sql = string.Format("SELECT Title,Name FROM Customer Inner JOIN User As T3 ON T3.Id = Customer.IdSaler WHERE Title like '%{0}%' Order BY Title LIMIT 10", text);
Monday, May 23, 2016 11:33 AM -
User1724605321 posted
Hi Aliyilmaz,
So your question is how to get data with inner join in ado.net ? ADO.NET runs straight SQL queries. try to below sql query :
SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name; or: SELECT column_name(s) FROM table1 JOIN table2 ON table1.column_name=table2.column_name;
You could try your query in SSMS to check whether it is correct .
Best Regards,
Nan Yu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 31, 2016 2:52 AM