Search Results

Search found 11573 results on 463 pages for 'store'.

Page 66/463 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • How to increment the string value during run time without using dr.read() and store it in the oledb

    - by sameer
    Here is my code, everything is working fine the only problem is with the ReadData() method in which i want the string value to be increment i.e AM0001,AM0002,AM0003 etc. This is happening but only one time the value is getting increment to AM0001, the second time the same value i.e AM0001 is getting return. Due to this i am getting a error from oledb because of AM0001 is a primary key field. enter code here: class Jewellery : Connectionstr { string lmcode = null; public string LM_code { get { return lmcode;} set { lmcode = ReadData();} } string mname; public string M_Name { get { return mname; } set { mname = value;} } string desc; public string Desc { get { return desc; } set { desc = value; } } public string ReadData() { string jid = string.Empty; string displayString = string.Empty; String query = "select max(LM_code)from Master_Accounts"; Datamanager.RunExecuteReader(Constr,query); if (string.IsNullOrEmpty(jid)) { jid = "AM0000";//This string value has to increment at every time, but it is getting increment only one time. } int len = jid.Length; string split = jid.Substring(2, len - 2); int num = Convert.ToInt32(split); num++; displayString = jid.Substring(0, 2) + num.ToString("0000"); return displayString; } public void add() { String query ="insert into Master_Accounts values ('" + LM_code + "','" + M_Name + "','" + Desc + "')"; Datamanager.RunExecuteNonQuery(Constr , query); } Any help will be appreciated.

    Read the article

  • How do I use cookies to store users' recent site history(PHP)?

    - by ggfan
    I decided to make a recent view box that allows users to see what links they clicked on before. Whenever they click on a posting, the posting's id gets stored in a cookie and displays it in the recent view box. In my ad.php, I have a definerecentview function that stores the posting's id (so I can call it later when trying to get the posting's information such as title, price from the database) in a cookie. How do I create a cookie array for this? **EXAMPLE:** user clicks on ad.php?posting_id='200' //this is in the ad.php function definerecentview() { $posting_id=$_GET['posting_id']; //this adds 30 days to the current time $Month = 2592000 + time(); $i=1; if (isset($posting_id)){ //lost here for($i=1,$i< ???,$i++){ setcookie("recentviewitem[$i]", $posting_id, $Month); } } } function displayrecentviews() { echo "<div class='recentviews'>"; echo "Recent Views"; if (isset($_COOKIE['recentviewitem'])) { foreach ($_COOKIE['recentviewitem'] as $name => $value) { echo "$name : $value <br />\n"; //right now just shows the posting_id } } echo "</div>"; } How do I use a for loop or foreach loop to make it that whenever a user clicks on an ad, it makes an array in the cookie? So it would be like.. 1. clicks on ad.php?posting_id=200 --- setcookie("recentviewitem[1]",200,$month); 2. clicks on ad.php?posting_id=201 --- setcookie("recentviewitem[2]",201,$month); 3. clicks on ad.php?posting_id=202 --- setcookie("recentviewitem[3]",202,$month); Then in the displayrecentitem function, I just echo however many cookies were set? I'm just totally lost in creating a for loop that sets the cookies. any help would be appreciated

    Read the article

  • How to extend WCF returned class properly?

    - by vikasde
    I am using a WCF service in my project. This service returns a class called "Store". I created a new local class which inherits from "Store". My class is called "ExtendedStore". My ExtendedStore looks like this: class ExtendedStore : StoreManagerService.Store { public int Id; .... } Now I am using the WCF service to cast to my class using the following code: StoreManagerService.StoreClient client = new StoreManagerService.StoreClient(); ExtendedStore store = (ExtendedStore) client.GetStore(); // bombs here I am not able to cast the returned Store class from the service to my ExtendedStore class. I get the below error message: Unable to cast object of type 'ConsoleApplication1.StoreManagerService.Store' to type 'ConsoleApplication1.ExtendedStore'. Shouldn't I be able to cast it? If not, is there a workaround?

    Read the article

  • Using jQuery to store basic text string in mySQL base?

    - by Kenny Bones
    Could someone point me in the right direction here? Basically, I've got this jQuery code snippet: $('.bggallery_images').click(function () { var newBG = "url('" + $(this).attr('src'); var fullpath = $(this).attr('src'); var filename = fullpath.replace('img/Bakgrunner/', ''); $('#wrapper').css('background-image', newBG); // Lagre til SQL $.ajax({ url: "save_to_db.php", // The url to your function to handle saving to the db data: filename, dataType: 'Text', type: 'POST', // Could also use GET if you prefer success: function (data) { // Just for testing purposes. alert('Background changed to: ' + data); } }); }); This is being run when I click a certain button. So it's actually within a click handler. If I understand this correctly, this snippet takes the source if the image I just clicked and strips it so I end up with only the filename. If I do an alert(filename), I get the filename only. So this is working ok. But then, it does an ajax call to a php file called "save_to_db.php" and sends data: filename. This is correct right? Then, it does a callback which does an alert + data. Does this seem correct so far? Cause my php file looks like this: <?php require("dbconnect2.php"); $uploadstring = $_POST['filename']; $sessionid = $_SESSION['id']; echo ($sessionid); mysql_query("UPDATE brukere SET brukerBakgrunn = '$uploadstring' WHERE brukerID=" .$_SESSION['id']); mysql_close(); ?> When I click the image, the jQuery snippet fires and I get the results of this php file as output for the alert box. I think that the variables somehow are empty. Because notice the echo($sessionid); which is a variable I've created just to test what the session ID is. And it returns nothing. What could be the issue here? Edit: I just tried to echo out the $uploadstring variable as well and it also returns nothing. It's like the jQuery snippet doesn't even pass the variable on to the php file?

    Read the article

  • Best directory to store application data with read\write rights for all users?

    - by Wodzu
    Hi guys. Until Windows Vista I was saving my application data into the directory where the program was located. The most common place was "C:\Program Files\MyApplication". As we know, under Vista and later the common user does't have rights to write under "Program Files" folder. So my first idea was to save the application data under "All Useres\Application Data" folder. But it seams that this folder has writing restrictions too! So to sum up, my requirements are: Folder should exist under Windows XP and above Microsoft's systems. All useres of the system should read\write\creation rights to this folder and it subfolders and files. I want to have only one copy of file\files for all useres. Thanks for your time.

    Read the article

  • Where does MSBuild store it's options, and how can I change them?

    - by Neil
    We have a large project at work, under source control, including an MSBuild file to run the build. Recently, the build has stopped working on my machine (I get errors saying that 'zzz' is ambiguous in the namespace 'yyy'). The same MSBuild file is working fine on both the build server and my co-workers machines. I have tried cloning a new copy of the project from the shared repository, but even with a clean copy, the build is failing for me. I think it must be a problem with the MSBuild settings on my machine, but I haven't been able to find anything that tells me where they are. Any help would be appreciated, since I'm starting to think my machine has just gone crazy.

    Read the article

  • How to store multiple variables from a File Input of unknown size in Java?

    - by AlphaOmegaStrife
    I'm a total beginner with my first programming assignment in Java. For our programming assignment, we will be given a .txt file of students like so: 3 345 Lisa Miller 890238 Y 2 <-(Number of classes) Mathematics MTH345 4 A Physics PHY357 3 B Bill Wilton 798324 N 2 English ENG378 3 B Philosophy PHL534 3 A Dandy Goat 746333 Y 1 History HIS101 3 A" The teacher will give us a .txt file on the day of turning it in with a list of unknown students. My problem is: I have a specific class for turning the data from the file into variables to be used for a different class in printing it to the screen. However, I do not know of a good way to get the variables from the input file for the course numbers, since that number is not predetermined. The only way I can think of to iterate over that unknown amount is using a loop, but that would just overwrite my variables every time. Also, the teacher has requested that we not use any JCL classes (I don't really know what this means.) Sorry if I have done a poor job of explaining this, but I can't think of a better way to conceptualize it. Let me know if I can clarify. Edit: public static void analyzeData() { Scanner inputStream = null; try { inputStream = new Scanner(new FileInputStream("Programming Assignment 1 Data.txt")); } catch (FileNotFoundException e) { System.out.println("File Programming Assignment 1 Data.txt could not be found or opened."); System.exit(0); } int numberOfStudents = inputStream.nextInt(); int tuitionPerHour = inputStream.nextInt(); String firstName = inputStream.next(); String lastname = inputStream.next(); String isTuitionPaid = inputStream.next(); int numberOfCourses = inputStream.nextInt(); String courseName = inputStream.next(); String courseNumber = inputStream.next(); int creditHours = inputStream.nextInt(); String grade = inputStream.next(); To show the methods I am using now, I am just using a Scanner to read from the file and for Scanner inputStream, I am using nextInt() or next() to get variables from the file. Obviously this will not work when I do not know exactly how many classes each student will have.

    Read the article

  • Can JAXB store the class name in the XML so that the the deserialize code doesn't need knowledge of the class?

    - by Andrew
    It seems the standard approach for deserializing JAXB XML is to specify the package name when creating the context. Then, JAXB looks up the class based on the root element: JAXBContext jc = JAXBContext.newInstance("com.foo"); Unmarshaller u = jc.createUnmarshaller(); Object o = u.unmarshal(new StringReader("...")); I'm looking for a more flexible approach where I don't have to specify the package name and could still deserialize any object. This would be as simple as JAXB storing the package in the XML, but I can't seem to find out how to do this. I can write the code to do it myself but that would be unpleasant. It would like JAXB to do it, if possible. BTW, I am not using schemas, just Annotations and marshal/unmarshal. Any ideas?

    Read the article

  • Is there any way to store full size image returned from camera activity in internal memory ?

    - by SimpleGuy
    I am using Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(externalFileObj)); intent to call default camera activity. To get full image you need to specify intent.putExtra(). But this always requires URI that works only for external storage files. I tried to create a temp.jpg image in internal memory and pass its URI Uri.fromFile(new File(getFilesDir() + "/temp.jpg")); but the camera activity won't return back after the image is captured. So there is no way to get Full size image from default camera application in our activity without using any external storage ? Assuming that the device do not have SD card or currently in use is there no way I can avoid using it ? Yes I know we can create our own camerapreview surface but I want to use the default camera application as it is natural with many more options. Thanks.

    Read the article

  • Where does the AccountController in Asp.Net MVC 2 store its data?

    - by JLago
    I'm creating a website using ASP.NET MVC 2 and I'm thinking of using the default AccountController and Views to take care of the Users. The only problem is that, for all the rest, I'm using a Postgres database. Is there a way to link The account controller to a User class defined by me? I'm using Nhibernate to connect to the database, so I'll have a User class with whatever fields necessary. Thanks very much.

    Read the article

  • How can I store large amount of data from a database to XML (speed problem, part three)?

    - by Andrija
    After getting some responses, the current situation is that I'm using this tip: http://www.ibm.com/developerworks/xml/library/x-tipbigdoc5.html (Listing 1. Turning ResultSets into XML), and XMLWriter for Java from http://www.megginson.com/downloads/ . Basically, it reads date from the database and writes them to a file as characters, using column names to create opening and closing tags. While doing so, I need to make two changes to the input stream, namely to the dates and numbers. // Iterate over the set while (rs.next()) { w.startElement("row"); for (int i = 0; i < count; i++) { Object ob = rs.getObject(i + 1); if (rs.wasNull()) { ob = null; } String colName = meta.getColumnLabel(i + 1); if (ob != null ) { if (ob instanceof Timestamp) { w.dataElement(colName, Util.formatDate((Timestamp)ob, dateFormat)); } else if (ob instanceof BigDecimal){ w.dataElement(colName, Util.transformToHTML(new Integer(((BigDecimal)ob).intValue()))); } else { w.dataElement(colName, ob.toString()); } } else { w.emptyElement(colName); } } w.endElement("row"); } The SQL that gets the results has the to_number command (e.g. to_number(sif.ID) ID ) and the to_date command (e.g. TO_DATE (sif.datum_do, 'DD.MM.RRRR') datum_do). The problems are that the returning date is a timestamp, meaning I don't get 14.02.2010 but rather 14.02.2010 00:00:000 so I have to format it to the dd.mm.yyyy format. The second problem are the numbers; for some reason, they are in database as varchar2 and can have leading zeroes that need to be stripped; I'm guessing I could do that in my SQL with the trim function so the Util.transformToHTML is unnecessary (for clarification, here's the method): public static String transformToHTML(Integer number) { String result = ""; try { result = number.toString(); } catch (Exception e) {} return result; } What I'd like to know is a) Can I get the date in the format I want and skip additional processing thus shortening the processing time? b) Is there a better way to do this? We're talking about XML files that are in the 50 MB - 250 MB filesize category.

    Read the article

  • How can I store a useful value in my ASP.NET MVC site's URL and make it propagate?

    - by joshjs
    Let's say I have a simple ASP.NET MVC site with two views. The views use the following routes: /Foo and /Foo/Bar. Now let's say I want to use the URL to specify (just for the sake of example) the background color of the site. I want my routes to be, for instance, /Blue/Foo or /Green/Foo/Bar. Also, if I call Html.ActionLink from a view, I want the Blue or Green value to propagate. So, e.g., if I call Html.ActionLink("Bar", "Foo") from /Blue/Foo, I want /Blue/Foo/Bar to come back. How best can I do this? (Forgive me if I'm missing an existing post. This is hard for me to articulate concisely, so I'm not quite sure what to search for.)

    Read the article

  • Store a signed long int (32bit) as 4 octets?

    - by Doori Bar
    I managed to get a unsigned long int octets-representation (BE) by reading IPv4 methods, and I managed to read about how signed integers are using the MSB as the sign indicator, which makes 00 00 00 00 to be 0, while 7F FF FF FF is 2147483647. But I can't manage how to do the same for signed long integers? #include <stdio.h> #include <string.h> int main (void) { unsigned long int intu32; unsigned char octets[4]; intu32 = 255; octets[3] = (intu32) & 255; octets[2] = (intu32 >> 8) & 255; octets[1] = (intu32 >> 16) & 255; octets[0] = (intu32 >> 24) & 255; printf("(%d)(%d)(%d)(%d)\n", octets[0], octets[1], octets[2], octets[3]); intu32 = (octets[0] << 24) | (octets[1] << 16) | (octets[2] << 8) | octets[3]; printf("intu32:%lu\n", intu32); return 0; } Thanks in advance, Doori bar

    Read the article

  • get an id of child element and store in a variable using jquery?

    - by Simpson88Keys
    I'm basically trying to do exactly what the subject suggests, but I'm getting "undefined" in my alert, and I'm not entirely sure why. I am fairly new to jquery, so, I probably have the syntax wrong, but not sure where to go from here. I'll post both of my attempts, which both yield "undefined" in the alert... //In my first attempt, I'm trying to get the id of the inner a tag <ul> <li id="l1" class="active"><a href="#c1">Samp 1</a></li> <li id="l2" class=""><a href="#c2">Samp 2</a></li> <li id="l3" class=""><a href="#c3">Samp 3</a></li> </ul> var selected = $(".active).children("a").attr("id"); alert(selected); //In my second attempt, I'm trying to get the id of the currently selected li var selected = $(".active").attr("id"); alert(selected);

    Read the article

  • How to store the hostname in a variable in a .bat file?

    - by eqbridges
    I would like to convert this /bin/sh syntax into a widely compatible Windows batch script: host=`hostname` echo ${host} How to do this so that it'll work on any Windows Vista, Windows XP, and Windows 2000 machine? To clarify: I would then like to go on in the program and use the hostname as stored in the variable host. In other words, the larger goal of the program is not to simply echo the hostname.

    Read the article

  • Is there a standard place to store Spring library jar files?

    - by richj
    I've downloaded Spring 3.0.2 with dependencies and found that it contains 405 jar files. I usually keep third party libraries in a "lib" subdirectory, but there are so many Spring jars that it seems sensible to keep them separately so that they don't swamp the other libraries and to simplify version upgrades. I suspect that I want to keep the full set of libraries in Subversion, but only deploy the subset that is actually used. Do Spring users have a standard way to deal with this problem?

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >