Violet_82 89 Posting Whiz in Training

Right, maybe it is better to have all the code in here, just in case there is something I'm missing.
So here is the Home.aspx.cs file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;


public partial class Home : System.Web.UI.Page
{
    private int expenseID;//expense string can be rent, car, bills, food as integer so as 1,2,3,4
    private SqlCommand sqlCmd;
    private SqlConnection hookUp;
    private string strInsert;
    private string radioButtonId;
    private SqlDataReader reader;
    //private int storedInt;



    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {//returns false the first time the page is displayed true when redisplayed
            initForm();
        }

    }
    private void initForm() {
        amount.Visible = false;//hide amount info on page load
        rent.Checked = false;//unselect all radio buttons
        car.Checked = false;
        bills.Checked = false;
        food.Checked = false;
        radioButtonID.Value = "";//empty hidden field
        //System.Diagnostics.Debug.WriteLine("oh oh oh");

    }
    protected void CheckedChanged(object sender, EventArgs e)
    {
        amount.Visible = true;//showamount info on page load  
        /*find out the id of the selected button*/
        RadioButton buttonId = sender as RadioButton;//cast sender as button
       // radioButtonID.Text = buttonId.ID;//select the ID
       radioButtonId = radioButtonID.Value = buttonId.ID;//select the ID
       switch (radioButtonId) { 
           case "rent":
               expenseID = 1;
               break;
           case "car":
               expenseID = 2;
               break;
           case "bills":
               expenseID = 3;
               break;
           case "food":
               expenseID = 4;
               break;
       }
        //TO REMOVE
      //outputTxt.Text =  DateTime.Now.ToString("dd/MM/yyyy");
     //  outputTxt.Text = Convert.ToString(expenseID);

    }
    protected void submitForm(object sender, EventArgs e){
        hookUp = new SqlConnection("Server=localhost\\SqlExpress;Database=Applications;" + "Integrated Security=True");
        strInsert = "INSERT INTO expenses(Date,ExpenseId,Cost,Comment) VALUES (@date,@expenseid,@cost,@comment)";
        sqlCmd = new SqlCommand(strInsert, hookUp);
        //  sqlCmd.Parameters.Add("@date", …
Violet_82 89 Posting Whiz in Training

Line 7 of your code should refer to expenseID.Text or expenseId.SelectedValue (in the case of a dropdown or radiobutton list.)

No, that is a int variable and it has absolutely nothing to do with the error I'm getting!

Violet_82 89 Posting Whiz in Training

hi djjeavons,
thanks I populated the expenseCode table
expensesTable.jpg

but still get an error, the same one in fact. Is there something wrong with the data I used to populate the table with?
So just to make sure I've done things properly, let's summarize everything quickly:
First table called expenses (screenshot in previous post) has a primary key which is the recordedId and a foreign key which is ExpenseId. The second table called expenseCode has a primary key called Id (and that's the one that should be linked to the foreign key of the other table)

Sorry SpottyBlue, not sure what you mean?

Violet_82 89 Posting Whiz in Training

OK thanks, I saved them on the server and made sure they open on a new tab, here under the last tab "overtime application" http://antonioborrillo.co.uk/web-development/home.html

Violet_82 89 Posting Whiz in Training

OK sorry, found the answers to my above questions, here is the screenshot:
diskScreenshot.png

Violet_82 89 Posting Whiz in Training

sure could do, but I seem to understand that the missing partition isn't in fact missing, but it has a different label, is there is such a thing. What I mean is, coudn't partition 3 being in fact partition 5 (which is the one I am booting from)?
That testDisk, is it for windows or linux?

Violet_82 89 Posting Whiz in Training

no idea mate, I think grub was in the wrong place and it got reinstalled somewhere else, but don't quote me on that as I may be wrong. Fact is, it's fixed.

Violet_82 89 Posting Whiz in Training

OK, so in the end I fixed it using this http://sourceforge.net/p/boot-repair-cd/home/Home/. This re-installed grub and now I managed to boot ubuntu again. Thanks for all your help

Violet_82 89 Posting Whiz in Training

I was hoping to try without script first, almostbob. If I create a folder in the files system on the host server, how do I link to the file so to download them? Meaning, say the files sit in a folder called files and I want to link to them from my site how do I download them rather than just view them?

Violet_82 89 Posting Whiz in Training

that's it, I think that's the solution. I can upload the files to my host server, but then how do I link to them from the site?

Violet_82 89 Posting Whiz in Training

gerbil, thanks, it turned out to be partition 5 in the end. Anyway I followed the instruction in your older post:

root (hd0,3)
kernel /vmlinuz root=/dev/sda4
initrd /initrd.img
boot

and this is what I got:
http://s12.postimg.org/dsb15vwkt/ubuntu_boot.jpg

then I run boot and after quite a lot of run on my screen I ended up with (initramfs) at the prompt, see screenshot here:
http://s17.postimg.org/ukrbj68fj/initramfs.jpg

Violet_82 89 Posting Whiz in Training

OK I see, thanks for the code almostbob, so one way or another I will have to have a server side language script to do the job for me, sorry I didn't know, I would have thought that HTML5 had some way to host documents. I may have a look at github as well then

Violet_82 89 Posting Whiz in Training

Hello, I'm building an expenses application in asp.net and I'm attempting to insert some data in a SQL database in visul studio but I get the following error (screenshot here http://s13.postimg.org/4kjmn4nev/SQL_error.jpg):

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_expenses_ToexpenseCode". The conflict occurred in database "Applications", table "dbo.expenseCode", column 'Id'.
The statement has been terminated.

I've done a bit of googling and I've found something on stackoverflow saying that the error might happen because the table that contains the primary key needs to have data in before I insert data in the table with the foreign key...and that's exactly my situation, in that the table with the primary key (expenseCode) is empty.
So, as this is the first time I deal with primary and secondary keys, I thought it might be worth asking a few more questions.
First, here are the two tables:
expenseCode (primary key is id):
http://s11.postimg.org/6wdkcdlzn/expense_Code.jpg
and expenses (foreign key):
http://s12.postimg.org/b0mamknd9/expenses.jpg

Now, the first table expenseCode is supposed to contain the id (1,2,3,4) and a string denoting the expense type (food, bills, rent, car); the expenses table, among the other things, contains an int reference to that string stored in the other table (1 for rent, 2 for car, 3 for bills, 4 for food). So, if the solution to my problem is the above, how do I populate the first table? Should I hardcode the values (which to me seems the best …

Violet_82 89 Posting Whiz in Training

Ah, hang on, maybe I got things completely wrong. To store documents on an HTML site I have to use .net or any other server side language? This is the site (sorry for posting the link but I think it will help me to understand better http://antonioborrillo.co.uk/web-development/home.html)? The thing is the webhost doesn't support .net...

Violet_82 89 Posting Whiz in Training

Well, it's not going to be a filesystem as such: basically, the files are just code samples. On my site I talk about an application I developed and then I provide the code for it (I'm specifically talking about .net application so the files will be .aspx .aspx.cs etc). As said, I don't need to keep them private, and I don't need any versioning because those files are just for me to remember what I did

Violet_82 89 Posting Whiz in Training

OK cool, well I don't mind if they are public actually. If uploading to website is easier, I suppose I can go with that, and no, I don't need file versioning, so if I need to change anything on the files, I'll upload them again. So how would I go about that?
thanks

Violet_82 89 Posting Whiz in Training

Hi chaps, I'm not terribly sure how to go about this. I've got a small site where I want to add some files for people - well me since nobody will ever use that website - to download, a sort of repository if you like a bit like github maybe, but i'm not entirely sure how. Can I use github only for a few files (in other words, is github free considering I don't have an awful lot of files) or does anybody have another suggestion? The way I picture the whole thing in my head is to have the files directly downloadable from my site rather than going somewhere else. How feasible is that? A very quick look on google brought back only github related results...
thanks

Violet_82 89 Posting Whiz in Training

OK thanks

Violet_82 89 Posting Whiz in Training

I'd like to try gerbil's solution first, and if that fails I'll attempt something else

Violet_82 89 Posting Whiz in Training

@gerbil, OK so I'm back :-)! I had a go at what you said but I run into some problems when run your commands. Here is a picture of what I got http://s13.postimg.org/ei2s6bafb/IMG_20150106_180212.jpg
I'm not sure why partition 3 is missing...anyway, using the tab key relevaled a 5 partitions as expected but every time I tried to ls in any of them I got the same message:
Filename must be either an absolute pathname or blocklist.
So I run root on the 4th, root (hd0,4) but the system couldn't mount the partition. ANy idea?

Violet_82 89 Posting Whiz in Training

well, yes we could say it is, thanks everybody

Violet_82 89 Posting Whiz in Training

ok thanks

Violet_82 89 Posting Whiz in Training

Sorry JeorgeM I was replying to imti321 asking for a screenshot.
Yes I remember what you said but frankly I don't remember what I did in the SQL installation, I don't remember seeing an option to install both localDB and SQLEXPRESS. However, after a bit more research I came across this http://learningsqlserver.wordpress.com/2011/01/21/what-version-of-sql-server-do-i-have/ . This is really important and the reason being that it reminded me that I have installed a single instance, so rather than attempting to connect using localhost\SQLEXPRESS (and various combinations like the one you suggested which was something like .\SQLEXPRESS - sorry can't find the post now) I used only localhost, and it worked :-)!!

Violet_82 89 Posting Whiz in Training

you mean a screenshot of this?
currentConnection.jpg

Violet_82 89 Posting Whiz in Training

eh eh, I'm not far from them, I'm just far from that specific one, got my notebook here, I can't be without a computer.

Violet_82 89 Posting Whiz in Training

Well it's actually not incorrect. As I said, my work machine seems to have the same configuration and the connection string is the same as the above ((LocalDB)\v11.0) and even so when I connect to the database I can type localhost\SQLEXPRESS. On my machine I also have (LocalDB)\v11.0 under server instance name but as we have discussed, I can't use localhost\SQLEXPRESS but only (LocalDB)\v11.0

Violet_82 89 Posting Whiz in Training

ah OK, I found a few people ont he net saying that there was no needto escape the backslash, I'll update my code thanks.

Violet_82 89 Posting Whiz in Training

hi all,
I've got something odd going on here. Basically I created a database table in visual studio 2012, using localDB and saved it OK. Now, I'm trying to amend something in it and when I right click on the table (Overtime) to "Open table definition", it loads for about 5 minutes and then I get the following error:
localDB_problem.jpg
Has anybody seen this before?
There is a bit more, here is the description of the error (yes I did what it says to do with no difference):
localDB_problem_verbose.jpg

Violet_82 89 Posting Whiz in Training

I ping'd my ip and it works. I have noticed something though: if I go tools -- > options --> database tools --> data conection I see the following:
localDB_connection.jpg

I was wondering: I checked my work computer and it has the same string there under instance name, but what if I replaced that with sqlexpress?

Violet_82 89 Posting Whiz in Training

hi guys, in one of my .NET applications I need to connect to localDB but the code I wrote originally was for sql express and now it's returning an error understandly. Does anybody know what's the equivalent of this for localDB please?

protected void submitData(object sender, EventArgs e)
    {
        hookUp = new SqlConnection("Server=localhost\\SqlExpress;Database=test4;" + "Integrated Security=True");
        strInsert = "INSERT INTO Overtime(Week,HrsWorked,Overtime,Comment) VALUES (@week,@hrsWrk,@ovt,@cmmt)";
        HrsWorked = Convert.ToDecimal(hrs.Value);
        Overtime = HrsWorked - WRKHRS;
        sqlCmd = new SqlCommand(strInsert, hookUp);
        sqlCmd.Parameters.Add("@week", txtStartDate.Text);
        sqlCmd.Parameters.Add("hrsWrk", HrsWorked);
        sqlCmd.Parameters.Add("@ovt", Overtime);
        sqlCmd.Parameters.Add("@cmmt", TextArea1.Value);
        hookUp.Open();
        sqlCmd.ExecuteNonQuery();
        hookUp.Close();
        txtStartDate.Text = "";
        hrs.Value = "";
        TextArea1.Value = "";
    }

I presume the difference will only be in this line:
hookUp = new SqlConnection("Server=localhost\\SqlExpress;Database=test4;" + "Integrated Security=True");

Violet_82 89 Posting Whiz in Training

cool will give it a go gerbil, will have to wait till the new year unfortunately as I'm away, so I will leave the thread open and post back as soon as I try

Violet_82 89 Posting Whiz in Training

I'm not sure why you are doing all of this?

I think you have a point. I don't know, it's more like the principle really - the fact that I can connect using localhost\SQLEXPRESS on my work computer and the fact that it is so difficult to achieve something so simple on my home machine, which has the same configuration. Anyway, I think I'll forget about this and use localDB (with this connection string (localdb)\v11.0), providing that the only difference is the fact that I have to connect to it using a slightly different connection string, which isn't the end of the world after all.

@imti321: I still have the same problem, in that I can't connect to sqlexpress (I'm now downloading the data tools). As I said, nevermind, I can live with that as long as I can use localDB as I used SQLEXPRESS (same syntax except for the connection string)

Violet_82 89 Posting Whiz in Training

cool thanks guys

Violet_82 89 Posting Whiz in Training

thanks, when I land on that page, which one is it that I need to download? I presume the "code samples, Tools and utilities" but the link doesn't work http://archive.msdn.microsoft.com/DataDev

Violet_82 89 Posting Whiz in Training

all right, so I removed version 2014 and replaced it with 2012. The services are all running, I have enabled TCP/IP in SQL conf manager, there is only one thing missing that I'm not sure about:

Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.

The current IP address on IP2 is 169.254.33.89. I run ipconfig/all on the command prompt I get the below:
http://s21.postimg.org/s1ise3dpz/ipconfig.jpg

So should the IP address under IP2 in sql server conf manager be the same as IPv4 or subnet mask?

Violet_82 89 Posting Whiz in Training

OK I will try to install the 2012 version instead....will post back

Violet_82 89 Posting Whiz in Training

All right, so I have installed this http://msdn.microsoft.com/en-gb/evalcenter/dn434042.aspx and now I have all the services needed - I believe - and I have enabled the ones that were disabled, here is a screenshot:
http://s14.postimg.org/rtt873c1t/sql_Services_Updated.jpg
I haven't as yet tried to this as yet:
Make sure TCP/IP is enabled.

"Right-click on TCP/IP and select Properties.
Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.
Scroll down to IPAll.
Make sure that TCP Dynamic Ports is blank.
Make sure that TCP Port is set to 1433."

But I tried to give it a go, so I started VS 2012 and tried to connect with the usul string localhost\SQLEXPRESS and this time I got a different error:
http://s9.postimg.org/4q994n4bz/sql_Express_Error.jpg

Ah, I'm on WIndows 7 and visual studio 2012 installed

Violet_82 89 Posting Whiz in Training

No problem, well I got somewhere now, thanks for your help, I'll open another thread when the time comes, hopefully shortly!

Violet_82 89 Posting Whiz in Training

thanks, so how/where do I check the maximum charge rate?
Also, I've heard about underchargin and overchargin and problems that they could cause to batteries, is that true?

Violet_82 89 Posting Whiz in Training

Hi, thanks, yes I know what you mean, but I don't know if you saw my screenshot, those services (including any SQLEXPRESS ones) are not there at all, so there is no way I can start them, do you know waht I mean?

Violet_82 89 Posting Whiz in Training

thanks. Just checked, the SQLExpress service is not running, see screenshot:
2f7fbc13da0d06580f586fa9426873ff
Does it mean that it's not installed at all?

Violet_82 89 Posting Whiz in Training

Sorry maybe I'm getting confused too. What I was hoping for, was to get sql express to sort out that connection string problem, so that I can connect using localhost\SQLEXPRESS, and I thought that would solve the problem.

Violet_82 89 Posting Whiz in Training

OK so what would I need for mine, any idea?

Violet_82 89 Posting Whiz in Training

OK fab, thanks. Flipping visual studio 2012 seems to have changed the way you set primary keys and foreign keys, very counterintuitive, but hey; they want you to update the string as opposed to set it in visual studio http://bit.ly/1xaOLZ5. Cool, it looks like I've done it:
CONSTRAINT [FK_expenses_ToexpenseCode] FOREIGN KEY ([ExpenseId]) REFERENCES [expenseCode]([Id])
and field name changed to ExpenseId.
I have no idea what database I'm using, trying to get that resolved as well on another thread...
Will try your code too, but first need to see if it submits OK then will try to output!

Violet_82 89 Posting Whiz in Training

Hello guys, I wonder if you can help me at all. I have received a battery charger pack (6000mAh) for mobile phones, tablets and cameras, here is a screenshot of it
2bf1d890310c83236eb46f24619d9e6c
It has several connectors and can charge differend brands like apple android etc. OK, so I have a OPO device with android (battery 3100mAh), and I'd like to use the battery pack to charge it but as you can see from the picture it has 2 outputs: 5V 1A and 5V 2.1A. Unfortunately electronics isn't my thing, so I had a look on google but frankly I got more confused than before, and read that i need to make sure I use the right voltage otherwise I screw the phone battery: so, my question is, which output should I use with my OPO phone, and, more generally, which output is used for which device? Is there a rule of thumb of some kind?

Violet_82 89 Posting Whiz in Training

Oh, Ok hang on a second, as I'm not that good with databases. So, you're saying, in the first table keep id as primary key and then expenseType as foreign key. In the second instead, id still the primary key? So no foreign key in the second one?

Violet_82 89 Posting Whiz in Training

Hi guys,
I'm building a small asp.net application about montlhy expenses. I was given a bit of guidance in this thread https://www.daniweb.com/web-development/aspnet/threads/488532/building-monthly-expenses-application about how to organise the database. The situation currently is this. I have 2 tables in the same database, table "expenses" and "expenseCodes". The first contains the following data:
-id (int, primary key)
-Date (date)
-ExpenseTypes (int)
-Cost (decimal)
-Comment (nvarchar)

The second:
-id (int, primary key)
-ExpenseType (nvarchar)

So, the idea is that in the first table the expenseTypes contains int values and those values correspond to the ids that I keep in the second table: for example, say that 1 in "expenses" corresponds to foodTransaction, 2 = billTransaction, 3 = rentTransaction etc, then would it be OK if I set the ExpenseType as a foreign key in the second table (but the primary key in the first table is the ID)? Or should the foreign key be id in the second table?

Violet_82 89 Posting Whiz in Training

OK I'll try that but I know that the server name is correct. What I'm trying to say here is that on my work machine I didn't have to do any of that, I simply installed VS and connected to the database using locahost\SQLEXPRESS and on my machine I can't do it.I'll definitely check the points you listed imti321 but still it doesn't explain why it doesn't work on my machine.

You could stay with localdb and if you publish the web application somewhere else you just need to update your connection string(s). Nothing else in your app should change.

What if I also install SQL express? WOuld I then be able to use it in place of localdb?

Violet_82 89 Posting Whiz in Training

Sorry, just realized that my previous post has lost bits somehow, @gerbil. What I meant was that I followed the instructions as detailed in your link and when I boot I get the choice of the OS http://s14.postimg.org/4d4jcboip/enu.jpg but when I select NeoGrub I get this http://s13.postimg.org/okiducm1z/prompt.jpg and I don't seem to be able to access the GUI. ANy idea how to do that?

Violet_82 89 Posting Whiz in Training

mm does it mean that I can use the same commands for localdb or are they different from SQL express? So, say that I want to use SQL Express (I suppose the reason why I can't connect to localhost/sqlexpress is because there is no sql express on my machine - is that a fair assumption?) can I install it? Is there any specific version I should get? If I install it, will I be able to connect to localhost/sqlexpress?
thanks