I have tried rewriting this query a few different ways, but with no luck. Help here is much appreciated.
function createWaterBodyDropDown(region) {
var query = "SELECT 'LAKE_NAME' FROM 1IfQgRAeKPbVJwEpAnqqpYlN8sgiPMg1VQ_RyArI WHERE 'REGION'=" + '"' + region + '"';
var queryText = encodeURIComponent(query);
var gvizQuery = new google.visualization.Query(
'http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
//Send query and draw table with data in response
gvizQuery.send(function (response) {
var str;
var numRows = response.getDataTable().getNumberOfRows();
var numCols = response.getDataTable().getNumberOfColumns();
var name = [
'<label style="font-weight:bolder;font-size:16px">Water body: </label>' + '<select id="waterbody_menu" style="font-size:16px;" onchange="select_waterBody(this.options[this.selectedIndex].value);">' + '<option value="">--All--</option>'
];
for (var i = 0; i < numRows; i++) {
var val = response.getDataTable().getValue(i, 0);
name.push("<option value=" + "'" + val + "'" + ">" + val + "</option>");
}
name.push('</select>');
document.getElementById('waterBody_container').innerHTML = name.join('');
});
}
Your column names have no special characters so they don't need to be quoted, though they could be (with single quotes). String values must be quoted with single quotes. See the reference manual for more details.
So:
SELECT LAKE_NAME FROM 1IfQgRAeKPbVJwEpAnqqpYlN8sgiPMg1VQ_RyArI WHERE REGION = 'foobar'
Related
var LR_No_Of_Days = "";
$("#DateRange").jqxDateTimeInput({ width: 250, height: 25, selectionMode: 'range' }); $("#DateRange").on('change', function (event) {
var selection = $("#DateRange").jqxDateTimeInput('getRange');
if (selection.from != null) {
$("#selection").html("<div>From: " + selection.from.toLocaleDateString() + " <br/>To: " + selection.to.toLocaleDateString() + "</div>");
}
var LR_Request_Date_From = selection.from.toLocaleDateString();
var LR_Request_Date_To = selection.to.toLocaleDateString();
$('#LR_Request_Date_From').val(LR_Request_Date_From);
$('#LR_Request_Date_To').val(LR_Request_Date_To);
NoOfdays();
function NoOfdays() {
var LR_No_Of_Days = Math.floor((Date.parse(LR_Request_Date_To) - Date.parse(LR_Request_Date_From)) / 86400000); if (LR_No_Of_Days == '0') {LR_No_Of_Days = 1;} else { LR_No_Of_Days-1; }; alert(LR_Request_Date_From + " &&& " + LR_Request_Date_To + " No of days:" + LR_No_Of_Days);
$("#LR_No_Of_Days").val(LR_No_Of_Days);}});
I'm unable to convert the string variable(LR_Request_Date_From and LR_Request_Date_To) to date format. I receive error converting string to date.
You have to use MM instead of mm and CultureInfo.InvariantCulture as second parameter
string dt = DateTime.Parse(txtVADate.Text.Trim()).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);
I am trying to get data from other website using NuGet but its not get anything.
var aTags showing null value.
var getHtmlWeb = new HtmlWeb();
var document = getHtmlWeb.Load("https://www.google.com");
var aTags = document.DocumentNode.SelectNodes("//a");
int counter = 1;
if (aTags != null)
{
foreach (var aTag in aTags)
{
Label1.Text += counter + ". " + aTag.InnerHtml + " - " + aTag.Attributes["href"].Value + "\t" + "<br />";
counter++;
}
}
I have this date in table: "2013-10-08T00:00:00"
I want to set it in format "dd.MM.yyyy"
in datatable source i changed like this:
{
"bSortable": true,
"mData": "PublishDate",
"bSearchable": true,
"mRender": function (data, type, row) {
if (data) {
debugger;
var re = /-?\d+/;
var m = re.exec(data);
var d = new Date(parseInt(m[0]));
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1; //Months are zero based
var curr_year = d.getFullYear();
var formatedDate = curr_date + "/" + curr_month + "/" + curr_year + " " + d.getHours() + ":" + d.getMinutes();
return formatedDate;
}
else
return data
},
},
But it always return 1/1/1970 2:0
have any suggestions?
Try this:
var m = data.split(/[T-]/);
var d = new Date(parseInt(m[0]),parseInt(m[1])-1,parseInt(m[2]));
See: http://jsfiddle.net/vHTWL/
I'm trying to research the routed direction using google maps for asp.net control. Here is my Code.
GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];
GoogleMapForASPNet1.GoogleMapObject.Width = "1100px";
GoogleMapForASPNet1.GoogleMapObject.Height = "600px";
GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 10;
GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 1.352083, 103.819836);
GoogleMapForASPNet1.GoogleMapObject.ShowTraffic = true;
int count=0;
bool flag = false;
GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
foreach (var gitem in tblG)
{
foreach (var item in tblDT)
{
if (item.Latitude==gitem.Latitude && item.Longitude==gitem.Longitude && flag!=true)
{
count += 1;
GooglePoint GP1 = new GooglePoint();
GP1.ID = "GP" + count.ToString();
GP1.Latitude = Convert.ToDouble(gitem.Latitude);//latitude;
GP1.Longitude = Convert.ToDouble(gitem.Longitude);
GP1.InfoHTML = " Name:<b>" + Name + "</b></br>Point:<b>" + "GP" + count.ToString() + "</b></br>Time:<b>" + gitem.CDate.ToString() + "</b></br>";//stime;
GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
string address = gitem.Latitude + "," + gitem.Longitude;
GoogleMapForASPNet1.GoogleMapObject.Directions.Addresses.Add(address);
flag = true;
}
}
flag = false;
}
I want it as Routed Direction is only between start and End point.
But I got result look like driving Direction. I don't want to get that result. How to fix that problem?
I've been given working ASP code which I have to change in order to update existing data in database insted of creating new entries. I think I should swap INSERT INTO statment with UPDATE but the code is a bit too coplicated for me to figure out where and what to change.
Here it comes:
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
// query string to execute
var MM_editQuery = "";
// *** Insert Record: set variables
if (String(Request("MM_insert")) == "AddRecord") {
var MM_editConnection = MM_PhoneWeb_conn_STRING;
var MM_editTable = "Employees";
var MM_editRedirectUrl = "userRegister.asp";
var MM_fieldsStr = "textSurname|value|textFirstname|value|textUsername|value|textPass|value";
var MM_columnsStr = "Surname|',none,''|FirstName|',none,''|Username|',none,''|Password|',none,''";
// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|");
var MM_columns = MM_columnsStr.split("|");
// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(Request.Form(MM_fields[i]));
}
// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
}
}
// *** Insert Record: construct a sql insert statement and execute it
if (String(Request("MM_insert")) != "undefined") {
// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(",");
var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined") {
formVal = emptyVal;
} else {
if (altVal != "") {
formVal = altVal;
} else if (delim == "'") { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''") + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
MM_dbValues += ((i != 0) ? "," : "") + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";
if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);