Search Results

Search found 3113 results on 125 pages for 'spin city'.

Page 15/125 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Recursion Problems in Prolog

    - by Humble_Student
    I'm having some difficulties in prolog, I'm trying to write a predicate that will return all paths between two cities, although at the moment it returns the first path it finds on an infinite loop. Not sure where I'm going wrong but I've been trying to figure this out all day and I'm getting nowhere. Any help that could be offered would be appreciated. go:- repeat, f([],0,lon,spa,OP,OD), write(OP), write(OD), fail. city(lon). city(ath). city(spa). city(kol). path(lon,1,ath). path(ath,3,spa). path(spa,2,kol). path(lon,1,kol). joined(X,Y,D):- path(X,D,Y);path(Y,D,X). f(Ci_Vi,Di,De,De,PaO,Di):- append([De],Ci_Vi,PaO), !. f(Cities_Visited,Distance,Start,Destination,Output_Path,Output_Distance):- repeat, city(X), joined(Start,X,D), not_member(X,Cities_Visited), New_Distance is Distance + D, f([Start|Cities_Visited],New_Distance,X,Destination,Output_Path,Output_Distance). not_member(X,List):- member(X,List), !, fail. not_member(X,List). The output I'm expecting here is [spa,ath,lon]4 [spa,kol,lon]3. Once again, any help would be appreciated. Many thanks in advance.

    Read the article

  • Returning IEnumerable<T> vs IQueryable<T>

    - by stackoverflowuser
    what is the difference between returning iqueryable vs ienumerable. IQueryable<Customer> custs = from c in db.Customers where c.City == "<City>" select c; IEnumerable<Customer> custs = from c in db.Customers where c.City == "<City>" select c; Will both be deferred execution? When should one be preferred over the other?

    Read the article

  • jQuery live change problem

    - by Milos
    When I click an element from list, jQuery get class from clicked element and write it in input field. Then value from input need to be written in div#content without any action. HTML: <ul> <li class="NewYork">New York</li> <li class="Paris">Paris</li> <li class="Moscow">Moscow</li> </ul> <input type="text" id="city" value="" /> <div id="content"></div> jQuery: $(document).ready(function() { $('ul li').live('click', function() { var select_value = $(this).attr('class'); $('input#city').val(select_value); return false; }); $('input#city').live('change', function() { var content = $(this).val(); $('#content').text(content+' is beautiful city'); }); });

    Read the article

  • CakePHP: How do I order results based on a 2-level deep association model?

    - by KcYxA
    I'm hoping I won't need to resort to custom queries. A related question would be: how do I retrieve data so that if an associated model is empty, no record is retrieved at all, as opposed to an empty array for an associated model? As an oversimplified example, say I have the following models: City -- Street -- House How do I sort City results by House numbers? How do I retrieve City restuls that have at least one House in it? I don't want a record with a city name and details and an empty House array as it messes up pagination results. CakePHP retrieves House records belonging to the Street in a separate query, so putting somthing like 'House.number DESC' into the 'order' field of the search query returns a 'field does not exist' error. Any ideas?

    Read the article

  • UIScrollView - Figuring out where the scroll will stop

    - by spin-docta
    I'm trying to figure out how to calculate where the scrollview will stop when a user does a swipe gesture and the scrollview goes into deceleration. I'm trying to use the delegate functions, but I can't accurately figure it out. Please help! - (void) scrollViewDidScroll:(UIScrollView *)scrollView; - (void) scrollViewWillBeginDecelerating:(UIScrollView *)scrollView; - (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView;

    Read the article

  • Nested partial output caching in asp.net mvc 3

    - by Anwar Chandra
    Hi All, I am using Razor view engine in ASP.Net MVC 3 RC 2 this is part of my view city.cshtml (drastically simplified for the sake of simple example) <!-- in city.cshtml --> <div class="list"> @foreach(var product in SQL.GetProducts(Model.City) ) { <div class="product"> <div>@product.Name</div> <div class="category"> @foreach(var category in SQL.GetCategories(product.ID) ) { <a href="@category.Url">@category.Name</a> » } </div> </div> } </div> I want to cache this part of my output using OutputCache attribute. so I created an action ProductList with OutputCache attribute enabled <!-- in city.cshtml --> <div class="list"> @Html.Action("ProductList", new { City = Model.City }) </div> and I created the view in ProductList.cshtml as below <!-- in ProductList.cshtml --> @foreach(var product in Model.Products ) { <div class="product"> <div>@product.Name</div> <div class="category"> @foreach(var category in SQL.GetCategories(product.ID) ) { <a href="@category.Url">@category.Name</a> » } </div> </div> } but I still need to cache the category path output on each product. so I created an action CategoryPath with OutputCache attribute enabled <!-- in ProductList.cshtml --> @foreach(var product in Model.Products ){ <div class="product"> <div>@product.Name</div> <div class="category"> @Html.Action("CategoryPath", new { ProductID = product.ID }) </div> </div> } but apparently this is not allowed. I got this error.. OutputCacheAttribute is not allowed on child actions which are children of an already cached child action. I believe they have a good reason why they need to disallow this. but I really want this kind of nested Output Caching Please, any idea for a workaround?

    Read the article

  • Why is the value not passed to my controller page in codeigniter?

    - by udaya
    I am selecting state from country and city from state. This is my country select box: <td width=""><select name="country" onChange="getState(this.value)" class="text_box_width_190"> <option value="0">Select Country</option> <? foreach($country as $row) { ?> <option value="<?=$row['dCountry_id']?>"><?=$row['dCountryName']?></option> <? } ?> </select></td> This is my state select box: <select name="state" id="state" class="text_box_width_190" > <option value="0">Select State</option> </select> This is my city select box: <td width=""><div id="citydiv"><select name="city" class="text_box_width_190"> <option>Select City</option> </select></div></td> This is my script: <script type ="text/javascript"> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getState(countryId) { var strURL="http://localhost/ssit/system/application/views/findState.php?country="+countryId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('statediv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getCity(countryId,stateId) { var strURL="http://localhost/ssit/system/application/views/findCity.php?country="+countryId+"&state="+stateId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('citydiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> This is my find state page: <? $country=intval($_GET['country']); $link = mysql_connect('localhost', 'root', ''); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ssit'); $query="Select dStateName,dState_id FROM tbl_state Where dCountry_id='1'"; $result=mysql_query($query); ?> <select name="state" onchange="getCity(<?=$country?>,this.value)"> <option value="0">Select State</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['dState_id']?>><?=$row['dStateName']?></option> <? } ?> </select> This is my find city page: <? $countryId=intval($_GET['country']); $stateId=intval($_GET['state']); $link = mysql_connect('localhost', 'root', ''); //changet the configuration in required if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ssit'); $query="Select dCityName,dCity_id FROM tbl_city Where dState_id='30'"; $result=mysql_query($query); ?> <select name="city"> <option>Select City</option> <? while($row=mysql_fetch_array($result)) { ?> <option value><?=$row['dCityName']?></option> <? } ?> </select> When I post a country, I can receive it but I can't receive my state and city. How to receive them?

    Read the article

  • How Do I insert Data in a table From the Model MVC?

    - by user54197
    I have data coming into my Model, how do I setup to insert the data in a table? public string Name { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public string Zip { get; set; } public Info() { using (SqlConnection connect = new SqlConnection(connections)) { string query = "Insert Into Personnel_Data (Name, StreetAddress, City, State, Zip, HomePhone, WorkPhone)" + "Values('" + Name + "','" + Address + "','" + City + "','" + State + "','" + Zip + "','" + ContactHPhone + "','" + ContactWPhone + "')"; SqlCommand command = new SqlCommand(query, connect); connect.Open(); command.ExecuteNonQuery(); } } The Name, Address, City, and so on is null when the query is being run. How do I set this up?

    Read the article

  • How do you sort php and sql arrays?

    - by Jon
    How can I sort this array by city or by id in descending order? if ($num > 0 ) { $i=0; while ($i < $num) { $city = mysql_result($result,$i,"city"); $state = mysql_result($result,$i,"state"); $id = mysql_result($result,$i,"id"); echo "$city"; echo "$state"; ++$i; } } else { echo "No results."; } ?>

    Read the article

  • How Do I See The Final Text Of A Query Resulting From A Call To mysqli->prepare?

    - by Joshua
    After code like this: $stmt = $mysqli->prepare("SELECT District FROM City WHERE Name=?")) { $stmt->bind_param("s", $city); $stmt->execute(); $stmt->bind_result($district); $stmt->fetch(); printf("%s is in district %s\n", $city, $district); How Do I See The Actual SQL Statement That Was Executed? (It Should Look Something Like "SELECT District FROM City WHERE Name='Simi Valley';") I already realize that in this simplistic case it would be very easy to simply reconstruct the query... but how can I access it in a general way that will work for very complicated prepared statements, and cases where I don't necessarily already understand the intended structure of the query, etc. Isn't there some function or method that can be called on the statement object that will return the actual text of the SQL query, after binding?

    Read the article

  • What Controller/Action will this go to?

    - by rkrauter
    Assume this is the first route entry: routes.MapRoute( "myRoute", "employees/{city}/{pageNumber}", new { controller="Employees", action = "List", pageNumber = 1 } ); If I make the following request employees/london/2 it gets matched to the following action method: public ActionResult List(string city) {} How did that happen? I did not specify "city" in my object defaults: new { controller="Employees", action = "List", pageNumber = 1 } Please explain. Thanks!

    Read the article

  • How to change the behavior of string objects in web service calls via Windows Communication Foundati

    - by Geri Langlois
    I have third party api's which require string values to be submitted as empty strings. On an asp.net page I can use this code (abbreviated here) and it works fine: public class Customer { private string addr1 = ""; public string Addr1 { get {return addr1;} set {addr1 = value;} } private string addr2 = ""; public string Addr2 { get {return addr2;} set {addr2 = value;} } private string city = ""; public string City { get {return city;} set {city = value;} } } Customer cust = new Customer(); cust.Addr1 = "1 Main St."; cust.City = "Hartford"; int custno = CustomerController.InsertCustomer(cust); The Addr2 field, which was not initialized is still an empty string when inserted. However, using the same code but called it through a web service based on Windows Communication Foundation the Addr2 field is null. Is there a way (or setting) where all string fields, even if uninitialized, would return an empty string (unless, of course, a value was set).

    Read the article

  • How can I intelligently group rows of integers for a faceted search?

    - by Alastair
    I'm not even quite sure what terms I should be using for what I want, so any advice on what I'm even asking for would be very welcome. Basically, my web site lists user-generated accommodations. Each has a rent price, which users will be able to query in our new faceted search box. Users search by city, and within each city I'd like to present a different rent grouping. That is to say that in City #1, if we have listings ranging from $200 - $1000, I'd like to present checkboxes for: less than $300 $301 - $500 $501 - $700 more than $700 However, if City #2 has values that range from $500 - $1500, I want the ranges above to change accordingly. So, if I say that I want 5 or 6 range options in each city, I think I have two options: Take the min and max values and just split the difference. I don't like this idea because one listing with a rent of $10,000 will throw the whole scale off. Intelligently calculate the ranges using means, medians etc. Number 2 is what I need help with. I'm a web developer that gets logic, but was never strong on math and statistics at school. Can anyone point me towards a guide that'll help me figure this out?

    Read the article

  • Ajax with Jsf 1.1 implementation

    - by Rohan Ved
    I am using JSF1.1 in that, have this code_ <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://www.azureworlds.org" prefix="azure"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="x"%> <%@ taglib uri="http://www.asifqamar.com/jsf/asif" prefix="a"%> ... <x:selectOneMenu value="#{hotelBean.state}"> <f:selectItem itemLabel="Select One" itemValue="" /> <f:selectItem value="#{hotelBean.mapStates }" /> <x:ajax update="city" listener="#{hotelBean.handleCityChange}" /> </x:selectOneMenu> <h:outputText value="City* " /> <x:selectOneMenu id="city" value="#{hotelBean.city}"> <f:selectItem itemLabel="Select One" itemValue="" /> <f:selectItem value="#{hotelBean.mapCities }" /> </x:selectOneMenu> line x:ajax update="city" listener="#{hotelBean.handleCityChange}" is not working , i searched but got JSF1.1 not support for Ajax. then what can i do for this? and i have less knowledge of JS. Thanx

    Read the article

  • protect (encrypt) password in the web.config file (asp.net)

    - by Hazro City
    <system.net> <mailSettings> <smtp from="[email protected]" deliveryMethod="Network"> <network clientDomain="www.domain.com" host="smtp.live.com" defaultCredentials="false" port="25" userName=" [email protected] " password="password" enableSsl="true" /> </smtp> </mailSettings> </system.net> This is the case where I need encryption for my password. I searched and googled much on the web but I can’t be able to encrypt anymore. Can anyone help me do this in a simple but secure way.

    Read the article

  • Assigining ID vs object - linq to sql

    - by jess
    Say, I have an entity Customer which has relationship with city,order etc.Now,when I am adding a customer object,should I assign customer.cityid, or customer.city? Now,from form I get cityid from dropdown,to assign city object,I will have to make a query using id selected.

    Read the article

  • How to find specific value of the node in xml file

    - by user2735149
    I am making windows phone 8 app based the webservices. This is my xml code: - <response> <timestamp>2013-10-31T08:30:56Z</timestamp> <resultsOffset>0</resultsOffset> <status>success</status> <resultsLimit>8</resultsLimit> <resultsCount>38</resultsCount> - <headlines> - <headlinesItem> <headline>City edge past Toon</headline> <keywords /> <lastModified>2013-10-30T23:45:22Z</lastModified> <audio /> <premium>false</premium> + <links> - <api> - <news> <href>http://api.espn.com/v1/sports/news/1600444?region=GB</href> </news> </api> - <web> <href>http://espnfc.com/uk/en/report/381799/city-edge-toon?ex_cid=espnapi_public</href> </web> - <mobile> <href>http://m.espn.go.com/soccer/gamecast?gameId=381799&lang=EN&ex_cid=espnapi_public</href> </mobile> </links> <type>snReport</type> <related /> <id>1600444</id> <story>Alvardo Negredo and Edin Dzeko struck in extra-time to book Manchester City's place in the last eight of the Capital One Cup, while Costel Pantilimon kept a clean sheet in the 2-0 win to keep the pressure on Joe Hart. </story> <linkText>Newcastle 0-2 Man City</linkText> - <images> - <imagesItem> <height>360</height> <alt>Man City celebrate after Edin Dzeko scored their second extra-time goal at Newcastle.</alt> <width>640</width> <name>Man City celeb Edin Dzeko goal v nufc 20131030 [640x360]</name> <caption>Man City celebrate after Edin Dzeko scored their second extra-time goal at Newcastle.</caption> <type>inline</type> <url>http://espnfc.com/design05/images/2013/1030/mancitycelebedindzekogoalvnufc20131030_640x360.jpg</url> </imagesItem> </images> Code behind: myData = XDocument.Parse(e.Result, LoadOptions.None); var data = myData.Descendants("headlines").FirstOrDefault(); var data1 = from query in myData.Descendants("headlinesItem") select new UpdataNews { News = (string)query.Element("headline").Value, Desc = (string)query.Element("description"), Newsurl = (string)query.Element("links").Element("mobile").Element("href"), Imageurl=(string)query.Element("images").Element("imagesItem").Element("url").Value, }; lstShow.ItemsSource = data1; I am trying to get value from xml tags and assign them to News,Desc, etc. Everything works fine except Imageurl, it shows NullException. I tried same method for Imageurl, i dont know whats going wrong. Help..

    Read the article

  • Problem in java.util.Set.addAll() method

    - by Yatendra Goel
    I have a java.util.Set<City> cities and I need to add cities to this set in 2 ways: By adding individual city (with the help of cities.add(city) method call) By adding another set of cities to this set (with the help of cities.addAll(anotherCitiesSet) method call) But the problem in second approach is that i don't know whether there were any duplicate cities in the anotherCitiesSet. I want to do some processing whenever a duplicate entry is tried to be entered in thecities set.

    Read the article

  • jQuery and AJAX?

    - by Moshe
    I'm making a simple form which has 5 input elements for parts of an address. I use jQuery to build and send an AJAX request to a PHP file on my server. For some reason my jQuery is not properly able to read the values from my input elements. What could be wrong? Here is my jQuery: $('#submitButton').click(function(){ $('#BBRequestBox').html('<img src="images/loading.gif" />'); alert('Info: ' + $('#name').val() + ' ' + $('#street').val() + ' ' + $('#city').val() + ' ' + $('#state').val() + ' ' + $('#zip').val() + ' '); $.ajax({ type: "POST", url: "./bbrequest.php", data: {name: $('#name').val(), street: $('#street').val(), city: $('#city').val(), state: $('#state').val(), zip: $('#zip').val() }, success: function(msg){ $('#BBRequestBox').html('<p>' + msg + '</p>'); }, error: function(XMLHttpRequest, textStatus, errorThrown){ $('#BBRequestBox').html('<p> There\'s been an error: ' + errorThrown + '</p>'); } }); return false; }); Here is my HTML: <form action="#"> <label>Name:</label><input type="text" id="name" class="textbox"/> <label>Street:</label><input type="text" id="street" class="textbox" /> <label>City:</label><input type="text" id="city"class="textbox" /> <label>State:</label><input type="text" id="state" class="textbox"/> <label>Zip:</label><input type="text" id="zip" class="textbox" /> <input type="submit" value="Send Me a Bitachon Builder!" id="submitButton" /> </form>

    Read the article

  • Django save_m2m() and excluded field

    - by jul
    hi, in a ModelForm I replaced a field by excluding it and adding a new one with the same name, as shown below in AddRestaurantForm. When saving the form with the code shown below, I get an error in form.save_m2m() ("Truncated incorrect DOUBLE value"), which seems to be due to the function to attempt to save the tag field, while it is excluded. Is the save_m2m() function supposed to save excluded fields? Is there anything wrong in my code? Thanks Jul (...) new_restaurant = form.save(commit=False) new_restaurant.city = city new_restaurant.save() tags = form.cleaned_data['tag'] if(tags!=''): tags=tags.split(',') for t in tags: tag, created = Tag.objects.get_or_create(name = t.strip()) tag.save() new_restaurant.tag.add(tag) new_restaurant.save() form.save_m2m() models.py class Tag(models.Model): name = models.CharField(max_length=100, unique=True) class Restaurant(models.Model): name = models.CharField(max_length=50) city=models.ForeignKey(City) category=models.ManyToManyField(Category) tag=models.ManyToManyField(Tag, blank=True, null=True) forms.py class AddRestaurantForm(ModelForm): name = forms.CharField(widget=forms.TextInput(attrs=classtext)) city = forms.CharField(widget=forms.TextInput(attrs=classtext), max_length=100) tag = forms.CharField(widget=forms.TextInput(attrs=classtext), required=False) class Meta: model = Restaurant exclude = ('city','tag') Traceback: File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/home/jul/atable/../atable/resto/views.py" in addRestaurant 498. form.save_m2m() File "/var/lib/python-support/python2.5/django/forms/models.py" in save_m2m 75. f.save_form_data(instance, cleaned_data[f.name]) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in save_form_data 967. setattr(instance, self.attname, data) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in set 627. manager.add(*value) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in add 430. self._add_items(self.source_col_name, self.target_col_name, *objs) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in _add_items 497. [self._pk_val] + list(new_ids)) File "/var/lib/python-support/python2.5/django/db/backends/util.py" in execute 19. return self.cursor.execute(sql, params) File "/var/lib/python-support/python2.5/django/db/backends/mysql/ base.py" in execute 84. return self.cursor.execute(query, args) File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in execute 168. if not self._defer_warnings: self._warning_check() File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in _warning_check 82. warn(w[-1], self.Warning, 3) File "/usr/lib/python2.5/warnings.py" in warn 62. globals) File "/usr/lib/python2.5/warnings.py" in warn_explicit 102. raise message Exception Type: Warning at /restaurant/add/ Exception Value: Truncated incorrect DOUBLE value: 'a'

    Read the article

  • How to fix this simple SQL query?

    - by morpheous
    I have a database with three tables: user_table country_table city_table I want to write ANSI SQL which will allow me to fetch all the user data (i.e. user details including the name of the country of the last school and the name of the city they live in now). The problem I am having is that I have to use a self join, and I am getting slightly confused. The schema is shown below: CREATE TABLE user_table (id int, first_name varchar(16), last_school_country_id int, city_id int); CREATE TABLE country_table (id int, name varchar(32)); CREATE TABLE city_table (id int, country_id int, name varchar(32)); This is the query I have come up with so far, but the results are wrong, and sometimes, the db engine (mySQL), asks me if I want to show all [HUGE NUMBER HERE] results - which makes me suspect that I am unintentionally creating a cartesian product somewhere. Can someone explain what is wrong with this SQL statement, and what I need to do to fix it? SELECT usr.id AS id, usr.first_name, ctry1.name as loc_country_name, ctry2.name as school_country_name, city.name as loc_city_name FROM user_table usr, country_table ctry1, country_table ctry2, city_table city WHERE usr.last_school_country_id=ctry2.id AND usr.city_id=city.id AND city.country_id=ctry1.id AND ctry1.id=ctry2.id;

    Read the article

  • Access DB Transaction on insert or updating

    - by Raju Gujarati
    I am going to implement the database access layer of the Window application using C#. The database (.accdb) is located to the project files. When it comes to two notebooks (clients) connecting to one access database through switches, it throws DBConcurrency Exception Error. My target is to check the timestamp of the sql executed first and then run the sql . Would you please provide me some guidelines to achieve this ? The below is my code protected void btnTransaction_Click(object sender, EventArgs e) { string custID = txtID.Text; string CompName = txtCompany.Text; string contact = txtContact.Text; string city = txtCity.Text; string connString = ConfigurationManager.ConnectionStrings["CustomersDatabase"].ConnectionString; OleDbConnection connection = new OleDbConnection(connString); connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; OleDbTransaction transaction = connection.BeginTransaction(); command.Transaction = transaction; try { command.CommandText = "INSERT INTO Customers(CustomerID, CompanyName, ContactName, City, Country) VALUES(@CustomerID, @CompanyName, @ContactName, @City, @Country)"; command.CommandType = CommandType.Text; command.Parameters.AddWithValue("@CustomerID", custID); command.Parameters.AddWithValue("@CompanyName", CompName); command.Parameters.AddWithValue("@ContactName", contact); command.Parameters.AddWithValue("@City", city); command.ExecuteNonQuery(); command.CommandText = "UPDATE Customers SET ContactName = @ContactName2 WHERE CustomerID = @CustomerID2"; command.CommandType = CommandType.Text; command.Parameters.AddWithValue("@CustomerID2", custIDUpdate); command.Parameters.AddWithValue("@ContactName2", contactUpdate); command.ExecuteNonQuery(); adapter.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); transaction.Commit(); lblMessage.Text = "Transaction successfully completed"; } catch (Exception ex) { transaction.Rollback(); lblMessage.Text = "Transaction is not completed"; } finally { connection.Close(); } }

    Read the article

  • Fulltext and composite indexes and how they affect the query

    - by Brett
    Just say I had a query as below.. SELECT name,category,address,city,state FROM table WHERE MATCH(name,subcategory,category,tag1) AGAINST('education') AND city='Oakland' AND state='CA' LIMIT 0, 10; ..and I had a fulltext index as name,subcategory,category,tag1 and a composite index as city,state; is this good enough for this query? Just wondering if something extra is needed when mixing additional AND's when making use of the fulltext index with the MATCH/AGAINST. Edit: What I am trying to understand is, what happens with the additional columns that are within the query but are not indexed in the chosen index (the fulltext index), the above example being city and state. How does MySQL now find the matching rows for these since it can't use two indexes (or can it?) - so, basically, I'm trying to understand how MySQL goes about finding the data optimally for the columns NOT in the chosen fulltext index and if there is anything I can or should do to optimize the query.

    Read the article

  • Getting multiple aggregations in Single statement

    - by Harikrishnan R
    The table has data of city and its branchs/atms CITY TYPE NAME ---------------------------------- agra atm X agra branch X1 delhi atm X2 agra atm X3 agra atm X4 delhi branch X5 chennai branch X6 The result set expecting is CITY ATM BRANCH ------------------------------------ agra 3 1 delhi 1 1 chennai 0 1 Whether we can do this in one select statement.

    Read the article

  • Problems with Database Search Code (asp.net vb)

    - by Phil
    Here is a sample of my database search code: Dim sql As String = "Select * From Table Where " Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim andor As Boolean = AndOr1.SelectedValue 'selection can be AND or OR (0 / 1) 'Code for when the user selects AND If NameSearch.Text.ToString IsNot String.Empty And andor = 0 Then sql += "Surname LIKE '%" & name & "%' AND " End If If EmailSearch.Text.ToString IsNot String.Empty And andor = 0 Then sql += "Email LIKE '%" & email & "%' AND " End If If CitySearchBox.Text.ToString IsNot String.Empty And andor = 0 Then sql += "City LIKE '%" & city & "%' AND " End If 'Code for when the user selects OR If NameSearch.Text.ToString IsNot String.Empty And andor = 1 Then sql += "(Surname LIKE '%" & name & "%' OR " End If If EmailSearch.Text.ToString IsNot String.Empty And andor = 1 Then sql += "Email LIKE '%" & email & "%') OR " End If If CitySearchBox.Text.ToString IsNot String.Empty And andor = 1 Then sql += "(City LIKE '%" & city & "%' OR " End If sql = CleanString(sql) End Sub When the user selects AND (as andor.selectedvalue(0)) then the sql is produced fine like this; Select * From Table Where Surname LIKE '%test%' AND Email LIKE '%test%' AND City LIKE '%test%' But if the user selects OR (as andor.selectedvalue(1)), nothing is outputted except; Select * From Table Where Im sure the controls have values so are not string.empty and when the user selects OR the correct value 1 is being assigned to andor.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >