AleMonteiro 238 Can I pick my title?

Could you post your table schema and the desired result?

AleMonteiro 238 Can I pick my title?

I'm not a LINQ expert, but analysing your code, the first thing I'd try would be:

var query = from Table1 in datatable.AsEnumerable()
            join Table2 in Datatable2.AsEnumerable()
            on Table1.Field<int>("ID") equals Table2.Field<int>("ID")
            where Table1.Field<DateTime>("Date").Date < enddate.Date
            group Table2 by new {
                    Name = Table2.Field<string>("Name"), 
                    Amount = Table2.Field<double>("Amount"),
                } into c
            select new
            {
                  Amount = c.Sum(p => p.Field<double>("Amount"))
            };
AleMonteiro 238 Can I pick my title?

It can be done only with SQL but can also be done using VB.
I suggest an stored procedure to delete and execute in VB.

AleMonteiro 238 Can I pick my title?

There's no build-in function that does that.
I think the best approach is to search for the tables you want in the information schema and then delete them by name.

Here's a way: http://stackoverflow.com/questions/4393/drop-all-tables-whose-names-begin-with-a-certain-string

AleMonteiro 238 Can I pick my title?

Sorry, I couldn't understand what you are trying to do and also didn't get your problem.
Please explain better.

AleMonteiro 238 Can I pick my title?

With further evaluation, you could get a little more dynamic...

    var poslow = [1,2,3,4,5,6];
    var poshigh = [7,8,9,10,11,12];


    var popsRounds = [
        [1, undefined, undefined],
        [2, 7, 6],
        [3, 8, 5],
        [4, 9, 4],
        [5, 10, 3],
        [6, 11, 2],
        [7, 12, 1],
        [8, 6, 7],
        [9, 5, 8],
        [9, 4, 9],
        [10, 3, 10],
        [11, 2, 11]
    ];


    // this function displays all the positions on the screen aligned
    // in two rows one row has 1-6 the opposite row has 7-12
    function calculate(round, unshift, push)
    {
        document.write('<p style="color:red;">'+'round ' + round + ' </p>'+"<br/>");
        if ( typeof unshift != 'undefined' ) {
            poshigh.shift();
            poslow.pop();
            poslow.unshift(unshift);
            poshigh.push(push);
        }
        for( j=0, k=0; j < poslow.length, k < poshigh.length; j++,k++)
        {       
            document.write('<p style="color:blue;">'+poslow[j]+" "+poshigh[k]+'</p>');
        }
    }

    for(var i=0,il=popsRounds.length;i<il;i++) {
        var round = popsRounds[i];
        calculate(round[0], round[1], round[2]);

        // Even shorter would be
        // calculate.apply(calculate, popsRounds[i]);
    }
AleMonteiro 238 Can I pick my title?

I'd go with

SELECT TOP 3 FROM myTable ORDER BY myCol ASC
AleMonteiro 238 Can I pick my title?

I didn't get into the merit about the dating algorithm, but just by condensing your own logic...

    var poslow = [1,2,3,4,5,6];
    var poshigh = [7,8,9,10,11,12];

    // this function displays all the positions on the screen aligned
    // in two rows one row has 1-6 the opposite row has 7-12
    function calculate(round, unshift, push)
    {

        document.write('<p style="color:red;">'+'round ' + round + ' </p>'+"<br/>");

        if ( typeof unshift != 'undefined' ) {
            poshigh.shift();
            poslow.pop();
            poslow.unshift(unshift);
            poshigh.push(push);
        }

        for( j=0, k=0; j < poslow.length, k < poshigh.length; j++,k++)
        {       
            document.write('<p style="color:blue;">'+poslow[j]+" "+poshigh[k]+'</p>');
        }

    }


    // the first round don't pass parameters of unshift so it won't change the indexes
    calculate(1);

    calculate(2, 7, 6);
    calculate(3, 8, 5);
    calculate(4, 9, 4);
    calculate(5, 10, 3);
    calculate(6, 11, 2);
    calculate(7, 12, 1);
    calculate(8, 6, 7);
    calculate(9, 5, 8);
    calculate(9, 4, 9);
    calculate(10, 3, 10);
    calculate(11, 2, 11);


</script>
AleMonteiro 238 Can I pick my title?

This is not CSharp, it's SQL.
Try using the SQL Forum, and also provide a little more information on what you are trying to do.

AleMonteiro 238 Can I pick my title?

Yes, mattster, it's quite simple =)

Just keep in mind that if you have more than one instance installed on your DB Server, you'll need to enable SQL Browser and use the instance to connect.
Examples:

  • 192.168.0.120\SQLServer2008InstanceName
  • 192.168.0.120\SQLServer2005InstanceName
  • 192.168.0.120\SQLServer2003InstanceName

Another thing to bare in mind is the login method. If you're going to use Windows Authentication you'll need to use a valid user account in the DB Server.
Example: If you are using ASP.NET hosted on IIS:

<identity impersonate="true" 
          userName="dbserverdomain\username"
          password="password"/>

If you're going to use SQL Server Authentication, it's quite simpler, just set User Id and Password at the connection string.

AleMonteiro 238 Can I pick my title?

Mattster, yes, you can access SQL Server with C# in your home, office or internet.

The PC with SQL Server installed must have the firewall settings to permit the connection.

AleMonteiro 238 Can I pick my title?

You're welcome.

Just mark as solved =)

AleMonteiro 238 Can I pick my title?

I don't think you can have line breaks inside a string.

AleMonteiro 238 Can I pick my title?

Use a JSON validtor to help you find the problem(s).

http://jsonlint.com/
http://jsonformatter.curiousconcept.com

There's lots of others.

AleMonteiro 238 Can I pick my title?

LNU1, ListViewActivity onClick is not an OnClickListener object, it's an method.

On ListViewActivity, create a listener like

public OnClickListener myClick = new OnClickListener() {
    ...
};

And then use ctx.myClick

AleMonteiro 238 Can I pick my title?

It's printing twice because you're calling it twice..

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        worker1 = New Thread(AddressOf test)
        ' Logging "test" for first time
        worker1.Start() 
        ' Logging "Ready"
        log(logconsole, "Ready")
        'Logging "test" for second time
        test() 
    End Sub
robert.knighton.79 commented: thanks! I thought it had to be something silly like that! +0
AleMonteiro 238 Can I pick my title?

It's not important in wich class your listener is, what's important is in wich context it'll run.

This is not exactly what you are doing, in part because I didn't understand it all, but this may help...

class Parent extends Activity
{
    public Button btnTest;
    public Child objChild;

    void onCreate() {
        btnTest = findView..

        objChild = new Child();

        // Any of the tree options should work

        btnTest.setOnClickListener(myClick) // Parent Listener
        btnTest.setOnClickListener(objChild.myClick); // Child Listener
        btnTest.setOnClickListener(AnotherStatic.myClick); Static Click

    }

    OnClickListener myClick = new OnClickListener() { ... }
}

class Child 
{
    public OnClickListener myClick = new OnClickListener() { ... }
}

class AnotherStatic
{
    public static OnClickListener myClick = new OnClickListener() { ... }
}

The other way is also true, if you have the button property is public, any class with access to it could set the listener.

AleMonteiro 238 Can I pick my title?

You have to append the listener to the input:

$("input").keydown(function(event){
        if(event.keyCode == 9 ) {
          event.preventDefault();
          return false;
        }
      });
AleMonteiro 238 Can I pick my title?

You should really take in consideration what Taywin and Airshow said.

Nevertheless, try this:

//make all fields disbaled
$("#youTableID").find("input:text").attr("readonly", true);

// make only this tr editable
$("#tr-"+(disable_row)).find("input:text").removeAttr('readonly');

And when generating the tr

<tr id=tr-<?echo $tr_id; ?> >

And another thing, there's no such input type textbox, it's just text

<input type ="text" />
AleMonteiro 238 Can I pick my title?

The code seems alright... I tried this and it worked

<a href="#resume">
        <img src="http://i.msdn.microsoft.com/dynimg/IC86155.gif" onmouseover="this.src='http://arquivo.devmedia.com.br/artigos/Renato_Groffe/GAC/GAC4.jpg'" onmouseout="this.src='http://arquivo.devmedia.com.br/artigos/Renato_Groffe/GAC/GAC3.jpg'" alt="RESUME" />
    </a>

What browser are you using? Does it throw any errors?

AleMonteiro 238 Can I pick my title?

That's probably because your method returns an int.
Try this:

public string Execute_SQL(string select)
        {
            ConnectiontoSQL();
            string Query = "select " + select + " from jobSearch where searchID = 1";
            DataSet ds = SelectSQL(Query);
            if ( ds.Tables[0].Rows.Count > 0 ) { // Found something
                // Returns the first cell of the first row
                return ds.Tables[0].Rows[0][0].ToString();
            }
            // Exit code for no item found
            return "-1";
        }
AleMonteiro 238 Can I pick my title?

ggamble is right... I assume that you were selecting an int, because you was already converting.

If the value is 'monster.co.uk' you can't convert it, just use .ToString().

AleMonteiro 238 Can I pick my title?

I don't know much about access but try

cmb.CommandText = "DELETE * FROM Food WHERE FNo=" & x
AleMonteiro 238 Can I pick my title?

Whats the value in ds.Tables[0].Rows[0][0] ?

In debugging, use the Exception.StackTrace and Exception.InnerException.StackTrace to see exactly where the errors occurs and it's full stack trace.
Obs.: InnerException is recursive.

AleMonteiro 238 Can I pick my title?

First you need to split the string by the blank space and get the first part.
Then you create an Select Case or an If...Else If.

Dim original = "Aug 2014"
Dim str = Split(original, " ")(1)
Dim month = 0

if str = "Aug" Then
    month = 8
else if str = "Jul" Then
    month = 7
else if
.
.
.
AleMonteiro 238 Can I pick my title?

In wich line does this error occurrs?

AleMonteiro 238 Can I pick my title?

Is ds.Tables null? Is the connection and query ok?

AleMonteiro 238 Can I pick my title?

Hi there!

You can't convert an SQLDataReader to an int. You have to use the reader to get your values.

Check those links:
http://msdn.microsoft.com/pt-br/library/haa3afyz(v=vs.110).aspx
http://www.akadia.com/services/dotnet_data_reader.html

Anyway... I think is more practial to use an DataSet, something like this:

class Connection_Handler
    {
        SqlConnection cn;
        void ConnectiontoSQL()
        {
            string str = "server=xxx; database=jobSearch; user=sa; password=xxx";
            cn = new SqlConnection(str);
            cn.Open();            
        }
        public DataSet SelectSQL(string select) {

            SqlCommand command = new SqlCommand( select, this.cn );

            DataSet objDataSet = new DataSet();
            SqlDataAdapter objSqlDataAdapter;

            objSqlDataAdapter = new SqlDataAdapter( command );
            objSqlDataAdapter.Fill( objDataSet );

            command.Dispose();

            objSqlDataAdapter.Dispose();
            objSqlDataAdapter = null;

            return objDataSet;
        }

        public int Execute_SQL(string select)
        {
            ConnectiontoSQL();
            string Query = "select " + select + " from jobSearch where searchID = 1";

            DataSet ds = SelectSQL(Query);

            if ( ds.Tables[0].Rows.Count > 0 ) { // Found something

                // Returns the first cell of the first row
                return Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());

            }
            // Exit code for no item found
            return -1;
        }
    }

Or, if you are going to retrieve just one value, you could use ExecuteScalar that already returns the first cell of the first row.

int result = Convert.ToInt32(command.ExecuteScalar())
AleMonteiro 238 Can I pick my title?

Did you debug it? Is the line rw.Cells("date_deliver").Value = sdr("date_deliver") being executed?

Beside that, why are you making an loop for until 8 and only executing something when it's 8? It doesn't make a lot of sense to me.

I'd remove all that and increment your initial select to be like this:

SELECT 
    l.invoice_no, l.internal_id, l.customer_id, l.account_name, l.seller_name, l.terms, l.date_invoice, l.segment
    , IsNull(c.date_deliver, '') AS date_deliver
FROM
    om_list AS L
        LEFT JOIN cancel_discount AS C
            ON ( L.invoice_no = C.invoice_no )
AleMonteiro 238 Can I pick my title?

What's the error you get and in wich line?

AleMonteiro 238 Can I pick my title?

You're welcome.
Just mark as solved please.

AleMonteiro 238 Can I pick my title?

jelly46, if you are using jQuery, keep an open tab with the API, it's has a lot of methods that really make our lifes easier.

Here's the code with some explanations:

$("nav") // Select the menu
    .clone() // Clone it
        .appendTo("#footer"); // Append the cloned menu to the footer element

$(".pull") // Select all elements with 'pull' class
    .on('click', function(e) { 
        e.preventDefault();
        $(this) // this is the button being clicked
            .next('ul') // next('ul') will get the next element that is an ul in front of the clicked button
                .slideToggle(); // same as it was
    });

$(window).resize(function(){
    var w = $(window).width();
    if(w > 320) {
        $("nav ul:hidden") // This will get all menus that are hidden
            .removeAttr('style'); // This will happen to any and all elements returned by the above line (if none element is hidden, nothing will happen, no need to use an if before)
    }
});
AleMonteiro 238 Can I pick my title?

Jelly46, is something like this http://jsfiddle.net/7SwhL/ ?

AleMonteiro 238 Can I pick my title?

You're welcome!
Just mark as solved to help the forum be organized.

Seeya.

AleMonteiro 238 Can I pick my title?

Wich one is line 15 now?

AleMonteiro 238 Can I pick my title?

jnneson,

welcome to this loving, createfull and bizarre world of programming.

Based on what you said, I'd suggest you chosse what do you want to create first, and start learning that.

Examples... if you want to build your first web page, start with HTML and CSS, then JavaScript. If you got some of that, you can move to the server side, with PHP, Java or .Net, and further some database.

If you want to build an desktop app, for Windows go with .Net, for Linux, really don't know =/

Mobile? I'd go with Android.

Good luck.

AleMonteiro 238 Can I pick my title?

You are missing the closing '}' for codeAdress(), so it doesn't exist.
Didn't you see this in the console?

AleMonteiro 238 Can I pick my title?

Ok, that's great, but you didn't mark it yet, please do so =)

AleMonteiro 238 Can I pick my title?

Try something like this...

if ( window.location.toString().indexOf("myPage.html") > -1 ) {
    window.onbeforeunload...
}
AleMonteiro 238 Can I pick my title?

Sorry mate, I really didn't understand what you want.
You want to fill an datagrid only with columns without data? What's the point? The datagrid would be empty.

AleMonteiro 238 Can I pick my title?

This page is the same page that show the HTML? If so, all this code is being executed before any user interaction...

I suggest that you create an hidden input to know what do to... example:

<?php
    if ( $_POST["formAction"] == "insert" ) {
        // Insert code goes here
    }
?>

<input type="hidden" name="formAction" value="none"/>

<button type="submit" onclick="document.form.formAction.value = 'insert'; return true;">Send</button>
AleMonteiro 238 Can I pick my title?

Hi, first of all, put some description at your post, don't just drop the code.

So the problem seems to be that you can execute the stored procedure, right? Do you have permission to do so with the account your are logged in? Who is the owner of the SP? Try using the fully classified name like 'dbo.regionSelect'.

AleMonteiro 238 Can I pick my title?

I was not able to undertand what you area trying to do... but let me explain to you what your code is doing...

// Every TR inside .contact-names will have and double click event listener
$(".contact-names tr").live("dblclick", function(){
    // Name will be any content displayed inside the row
     var name = $(this).text();
     // Every .input-name will have the value 'name', regardless of where the input is
     $(".input-name").val(name);
     // 'msg2' will be appended to every .tr
     $(".tr").append(msg2);
     // Any content inside the row clicked will be removed
     // This doesn't make much sense, because the 'msg2' appended will also be removed
     $(this).empty();    
});
AleMonteiro 238 Can I pick my title?

Where do you call the initialize function?
The error is telling you that you are trying to set the header after you started the output.

AleMonteiro 238 Can I pick my title?

Put an alert($('.showproduct').find("div.product").length); on the showProductPage function and see what it says.

AleMonteiro 238 Can I pick my title?

The problem is that you are using the selector .image but it doesn't exist on your html.

Try this

function showProductPage( pageNo ) {
    var perPage = 2; T
    var start = pageNo * perPage; 
    var end = start + perPage; 
    $('.showproduct').find("div.product").hide().filter(function(index) { 
        return ( (index > (start-1)) && ( index < end ) ); 
    } ).show(); 
}
AleMonteiro 238 Can I pick my title?

The returned products. What does the var data hold?

AleMonteiro 238 Can I pick my title?

The function showProductPage is fine.
Post one example of the data content.

One thing, you don't need '<\/div>', just '</div>' is fine.

AleMonteiro 238 Can I pick my title?

You need to add your logic that will define which option must be selected, then you set it to selected like this:

<select name="mySelect">
    <option value="1">First Option</option>
    <option value="2" selected>Second Option</option>
</select>
AleMonteiro 238 Can I pick my title?

I suggest you use jQuery UI to achieve this, it'll be very easy.

Take a look in this demo, it's almost what you want: http://jqueryui.com/button/#splitbutton

This demo uses 3 jQuery UI feature: Button, Menu and Position.

<M/> commented: :) +7