Search Results

Search found 40287 results on 1612 pages for 'try statement'.

Page 9/1612 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Prepared statement alternatives for this middle-man program?

    - by user2813274
    I have an program that is using a prepared statement to connect and write to a database working nicely, and now need to create a middle-man program to insert between this program and the database. This middle-man program will actually write to multiple databases and handle any errors and connection issues. I would like advice as to how to replicate the prepared statements such as to create minimal impact to the existing program, however I am not sure where to start. I have thought about creating a "SQL statement class" that mimics the prepared statement, only that seems silly. The existing program is in Java, although it's going to be networked anyways so I would be open to writing it in just about anything that would make sense. The databases are currently MySQL, although I would like to be open to changing the database type in the future. My main question is what should the interface for this program look like, and does doing this even make sense? A distributed DB would be the ideal solution, but they seem overly complex and expensive for my needs. I am hoping to replicate the main functionality of a distributed DB via this middle-man. I am not too familiar with sql-based servers distributing data (or database in general...) - perhaps I am fighting an uphill battle by trying to solve it via programming, but I would like to make an attempt at least.

    Read the article

  • Is there a list of common object that implement IDisposable for the using statement?

    - by SkippyFire
    I was wondering if there was some sort of cheat sheet for which objects go well with the using statement... SQLConnection, MemoryStream, etc. Taking it one step further, it would be great to even show the other "pieces of the puzzle", like how you should actually call connection.Close() before the closing using statement bracket. Anything like that exist? If not, maybe we should make one.

    Read the article

  • How to do an if statement on a function in PHP?

    - by Bruce
    I just realized that you can't just use an if statement on a function, for example this doesn't work: function sayHello() { echo "Hello World"; } if(sayHello()) echo "Function Worked"; else echo "Function Failed"; I also saw that a function can't be put as the value of a variable. So how can I do an if statement to check if a function has executed properly and display it to the browser?

    Read the article

  • Should I put a try-finally block after every Object.Create?

    - by max
    I have a general question about best practice in OO Delphi. Currently, I put try-finally blocks anywhere I create an object to free that object after usage (to avoid memory leaks). E.g.: aObject := TObject.Create; try aOBject.AProcedure(); ... finally aObject.Free; end; instead of: aObject := TObject.Create; aObject.AProcedure(); .. aObject.Free; Do you think it is good practice, or too much overhead? And what about the performance?

    Read the article

  • 5 Ways To Try Out and Install Ubuntu On Your Computer

    - by Chris Hoffman
    Want to try out Ubuntu, but not sure where to start? There are lots of ways to try out Ubuntu – you can even install it on Windows and uninstall it from your Control Panel if you don’t like it. Ubuntu can be booted from a USB or CD drive and used without installation, installed under Windows with no partitioning required, run in a window on your Windows desktop, or installed alongside Windows on your computer. 6 Ways Windows 8 Is More Secure Than Windows 7 HTG Explains: Why It’s Good That Your Computer’s RAM Is Full 10 Awesome Improvements For Desktop Users in Windows 8

    Read the article

  • Arguments for or against using Try/Catch as logical operators

    - by James P. Wright
    I just discovered some lovely code in our companies app that uses Try-Catch blocks as logical operators. Meaning, "do some code, if that throws this error, do this code, but if that throws this error do this 3rd thing instead". It uses "Finally" as the "else" statement it appears. I know that this is wrong inherently, but before I go picking a fight I was hoping for some well thought out arguments. And hey, if you have arguments FOR the use of Try-Catch in this manner, please do tell. EDIT For any who are wondering, the language is C# and the code in question is about 30+ lines and is looking for specific exceptions, it is not handling ALL exceptions.

    Read the article

  • .Net: What is your confident approach in "Catch" section of try-catch block, When developing CRUD op

    - by odiseh
    hi, I was wondering if there would be any confident approach for use in catch section of try-catch block when developing CRUD operations(specially when you use a Database as your data source) in .Net? well, what's your opinion about below lines? public int Insert(string name, Int32 employeeID, string createDate) { SqlConnection connection = new SqlConnection(); connection.ConnectionString = this._ConnectionString; try { SqlCommand command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "UnitInsert"; if (connection.State != ConnectionState.Open) connection.Open(); SqlCommandBuilder.DeriveParameters(command); command.Parameters["@Name"].Value = name; command.Parameters["@EmployeeID"].Value = employeeID; command.Parameters["@CreateDate"].Value = createDate; int i = command.ExecuteNonQuery(); command.Dispose(); return i; } catch { **// how do you "catch" any possible error here?** return 0; // } finally { connection.Close(); connection.Dispose(); connection = null; } }

    Read the article

  • Bind Variable and SQL error during statement preparation

    - by Abhishek Dwivedi
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}  I was getting the following exception at run-time. JBO-27122: SQL error during statement preparation. Statement: SELECT AxEO.A_ID, AxEO.B_ID, AxEO.C_ID, ByEO.A_ID, ByEO.B_ID, ByEO.C_ID, Cz.A_ID, Cz.B_ID, Cz.C_ID FROM ABC_x AxEO, ABC_y ByEO, ABC_z CzEO WHERE AxEO.A_ID = ByEO.A_ID AND  CzEO.A_ID = :Bind_PId I copied and pasted the query on SQL worksheet, replaced :Bind_PId with a valid id, and executed the query. The query worked alright, implying the query was alright. I tried to connect to different DBs but the issue persisted, meaning it was not a DB issue either. Finally, the root cause was found to be in the concerned VO; one of the bind variables (say Bind_TId) was marked "Required". De-selecting the Required check-box resolved the issue. In retrospect, the issue looks to be rather straight-forward. However, the error message is not very helpful, if not misleading. Besides, it's counter-intuitive to think that a bind variable which is not being used in a query can cause error while statement preparation. The other bind variable - Bind_TId - was being used in other view criteria, not the view criteria involved in the given query. Still, it was required.

    Read the article

  • Execute TSQL statement with ExecuteStoreQuery in entity framework 4.0

    - by Jalpesh P. Vadgama
    I was playing with entity framework in recent days and I was searching something that how we can execute TSQL statement in entity framework. And I have found one great way to do that with entity framework ‘ExecuteStoreQuery’ method. It’s executes a TSQL statement against data source given enity framework context and returns strongly typed result. You can find more information about ExcuteStoreQuery from following link. http://msdn.microsoft.com/en-us/library/dd487208.aspx So let’s examine how it works. So Let’s first create a table against which we are going to execute TSQL statement. So I have added a SQL Express database as following. Now once we are done with adding a database let’s add a table called Client like following. Here you can see above Client table is very simple. There are only two fields ClientId and ClientName where ClientId is primary key and ClientName is field where we are going to store client name. Now it’s time to add some data to the table. So I have added some test data like following. Now it’s time to add entity framework model class. So right click project->Add new item and select ADO.NET entity model as following. After clicking on add button a wizard will start it will ask whether we need to create model classes from database or not but we already have our client table ready so I have selected generate from database as following. Once you process further in wizard it will be presented a screen where we can select the our table like following. Now once you click finish it will create model classes with for us. Now we need a gridview control where we need to display those data. So in Default.aspx page I have added a grid control like following. <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EntityFramework._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <p> To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>. </p> <p> You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409" title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>. <asp:GridView ID="grdClient" runat="server"> </asp:GridView> </p> </asp:Content> Now once we are done with adding Gridview its time to write code for server side. So I have written following code in Page_load event of default.aspx page. protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (var context = new EntityFramework.TestEntities()) { ObjectResult<Client> result = context.ExecuteStoreQuery<Client>("Select * from Client"); grdClient.DataSource = result; grdClient.DataBind(); } } } Here in the above code you can see that I have written create a object of our entity model and then with the help of the ExecuteStoreQuery method I have execute a simple select TSQL statement which will return a object result. I have bind that object result with gridview to display data. So now we are done with coding.So let’s run application in browser. Following is output as expected. That’s it. Hope you like it. Stay tuned for more..Till then happy programming.

    Read the article

  • Add "not" to if statement in shell script

    - by John Crawford
    I have the following script that should exist if the user does not exist. #check if user currently exists on system if id $User > /dev/null 2>&1 then #user exists no need to exit program echo "blah blah, what a waste of space" else echo "This user does NOT exists. Please create that user before using this script.\n" exit fi My problem is that I would ideally like to place a "not" if that first if statement so that I can trim down my if, else statement. Ideally I would like something like this: if !(id $User > /dev/null 2>&1) then echo "This user does NOT exists. Please create that user before using this script.\n" exit fi

    Read the article

  • Neues Statement Of Direction veröffentlicht

    - by carstenczarski
    Das APEX Entwicklerteam hat ein neues Statement Of Direction (SOD) für die Version 5.0 veröffentlicht. Wie immer wird es die Verbesserung und Erweiterung vorhandener und die Einführung neuer Funktionen geben. Wie immer, ist das Statement Of Direction dazu gedacht, die Pläne und Ziele des APEX-Entwicklerteams mit der Community zu teilen. Insofern ist für APEX 5.0 unter anderem geplant ... ... modale Dialoge deklarativ bereitzustellen ... den Drag and Drop Layout Editor zurückzubringen ... HTML5 noch besser zu unterstützen ... mehr Varianten und Möglichkeiten für PDF-Ausgabe bereitzustellen ... spezielle User Interfaces für Tablets einzuführen ... Master / Detail / Detail Formulare zu ermöglichen ... mehrerer Interaktive Berichte auf einer Seite zu erlauben ... und vieles weitere mehr. Die APEX-Erfolgsgeschichte geht also weiter.

    Read the article

  • How can I make an SQL statement that finds unassociated records?

    - by William Calleja
    I have two tables as follows: tblCountry (countryID, countryCode) tblProjectCountry(ProjectID, countryID) The tblCountry table is a list of all countries with their codes and the tblProjectCountry table associates certain countries with certain projects. I need an SQL statement that gives me a list of the countries with their country code that do NOT have an associated record in the tblProjectCountry table. so far I got to here: SELECT tblCountry.countryID, tblCountry.countryCode FROM tblProjectCountry INNER JOIN tblCountry ON tblProjectCountry.countryID = tblCountry.countryID WHERE (SELECT COUNT(ProjectID) FROM tblProjectCountry WHERE (ProjectID = 1) AND (countryID = tblCountry.countryID)) = 0 The above statement parses as correct but doesn't give the exact result I'm looking for. Can anyone help?

    Read the article

  • How do I implement a fibonacci sequence in java using try/catch logic?

    - by Lars Flyger
    I know how to do it using simple recursion, but in order to complete this particular assignment I need to be able to accumulate on the stack and throw an exception that holds the answer in it. So far I have: public static int fibo(int index) { int sum = 0; try { fibo_aux(index, 1, 1); } catch (IntegerException me) { sum = me.getIntValue(); } return sum; } fibo_aux is supposed to throw an IntegerException (which holds the value of the answer that is retireved via getIntValue) and accumulates the answer on the stack, but so far I can't figure it out. Can anyone help?

    Read the article

  • In an If-Else Statement for a method return, should an Else be explicitly stated if it can instead b

    - by ccomet
    I have a method that checks certain things and returns a Boolean based on those checks. It involves a single branching If section that checks about 5 conditions in sequence. If any of those conditions return true, then the method will return true;. If none of the conditions return true, then the method will return false;. Since the code after the If section will only run if none of the conditions are true, then that code is logically identical to including an actual Else statement. So is it a better idea to actually write in the Else statement for this kind of situation?

    Read the article

  • Unhandled exception, even after adding try-catch block ? C++

    - by user2525503
    try { bool numericname=false; std::cout <<"\n\nEnter the Name of Customer: "; std::getline(cin,Name); std::cout<<"\nEnter the Number of Customer: "; std::cin>>Number; std::string::iterator i=Name.begin(); while(i!=Name.end()) { if(isdigit(*i)) { numericname=true; } i++; } if(numericname) { throw "Name cannot be numeric."; } } catch(string message) { cout<<"\nError Found: "<< message <<"\n\n"; } Why am I getting unhandled exception error ? Even after I have added the catch block to catch thrown string messages?

    Read the article

  • Checking if the email had been already taken in the following if statement (Rails)?

    - by alexchenco
    I have the following action: users.rb: def omniauth_create auth = request.env["omniauth.auth"] user = User.from_omniauth(env["omniauth.auth"]) unless user.email.blank? if user.id.nil? # Save the user since he hasn't been created yet user.save! end sign_in user redirect_back_or user else # Send user to a form to fill his email #session[:omniauth] = request.env['omniauth.auth'].except('extra') redirect_to(enter_email_path(oprovider: user.provider, ouid: user.uid, oname: user.name, opassword: user.password, opassword_confirmation: user.password)) end end It does the following: If the user's email is not blank, sign him in, and redirect him to his profile (and save him if his id is nil. In other words, if he hasn't been created yet). If the user's email is blank, send him to enter_email_path (where the user can enter his email). Now I want to add another if statement that flashes an error if the email had been already taken, and redirects the user to the root_path I'm not very sure how to do this, Any suggestions? (and where to put that if statement?)

    Read the article

  • Forget PPC Try SEO

    Today we are living in a online world, where we can make any purchase sitting at home using the Internet. Thus the online business and the consumer who are making online purchase are increasing day by day. So now the companies have already started thinking seriously and implementing the means and methods of search engine marketing. Using this technique web-masters try to attract quality and quantity traffic to their website, so that they can earn business from them.

    Read the article

  • 12.04 "Try Ubuntu without installing" results in graphical artifacts on MacBook

    - by ubuntukeks
    I am trying to bless my MacBookPro 5,3 (Unibody/Core2Duo/Nvidia 9400M+Nvidia 9600M GT) with Ubuntu 12.04 (already got rEFIt running), but every time I select Try Ubuntu without installing, it will lock up and always give me the same coloured graphical artifacts all over the screen. Whether I use a CD-ROM or a USB Stick, it does not change a thing. Is there anything else that can be done or am I stuck for now?

    Read the article

  • "Try Ubuntu without installing" results in graphical artifacts on MacBook

    - by ubuntukeks
    I am trying to bless my MacBookPro 5,3 (Unibody/Core2Duo/Nvidia 9400M+Nvidia 9600M GT) with Ubuntu 12.04 (already got rEFIt running), but every time I select Try Ubuntu without installing, it will lock up and always give me the same coloured graphical artifacts all over the screen. Whether I use a CD-ROM or a USB Stick, it does not change a thing. Is there anything else that can be done or am I stuck for now?

    Read the article

  • Try Out the New Microsoft Desktop Player

    Microsoft Desktop Player allows developers to access technical content (such as videos, webcasts, podcasts, and white papers) and links to resources (including developer evangelists, local training opportunities, and local user groups) in your area. View it online or download the WPF application to view offline. Try it today!...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Making a Job Change That's Easy Why Not Try a Career Change

    - by david.talamelli
    A few nights ago I received a comment on one of our blog posts that reminded me of a statistic that I heard a while back. The statistic reflected the change in our views towards work and showed how while people in past generations would stay in one role for their working career - now with so much choice people not only change jobs often but also change careers 4-5 times in their working life. To differentiate between a job change and a career change: when I say job change this could be an IT Sales person moving from one IT Sales role to another IT Sales role. A Career change for example would be that same IT Sales person moving from IT Sales to something outside the scope of their industry - maybe to something like an Engineer or Scuba Dive Instructor. The reason for Career changes can be as varied as the people who make them. Someone's motivation could be to pursue a passion or maybe there is a change in their personal circumstances forcing the change or it could be any other number of reasons. I think it takes courage to make a Career change - it can be easy to stay in your comfort zone and do what you know, but to really push yourself sometimes you need to try something new, it is a matter of making that career transition as smooth as possible for yourself. The comment that was posted is here below (thanks Dean for the kind words they are appreciated). Hi David, I just wanted to let you know that I work for a company called Milestone Search in Melbourne, Victoria Australia. (www.mstone.com.au) We subscribe to your feed on a daily basis and find your blogs both interesting and insightful. Not to mention extremely entertaining. I wonder if you have missed out on getting in journalism as this seems to be something you'd be great at ?: ) Anyways back to my point about changing careers. This could be anything from going from I.T. to Journalism, Engineering to Teaching or any combination of career you can think of. I don't think there ever has been a time where we have had so many opportunities to do so many different things in our working life. While this idea sounds great in theory, putting it into practice would be much harder to do I think. First, in an increasingly competitive job market, employers tend to look for specialists in their field. You may want to make a change but your options may be limited by the number of employers willing to take a chance on someone new to an industry that will likely require a significant investment in time to get brought up to speed. Also, using myself as an example if I was given the opportunity to move into Journalism/Communication/Marketing career from my career as an IT Recruiter - realistically I would have to take a significant pay cut to make this change as my current salary reflects the expertise I have in my current career. I would not immediately be up to speed moving into a new career and would not be able to justify a similar salary. Yes there are transferable skills in any career change, but even though you may have transferable skills you must realise that you will also have a large amount of learning to do which would take time. These are two initial hurdles that I immediately think of, there may be more but nothing is insurmountable. If you work out what you want to do with your working career whatever that may be, you then need to just need to work out the steps to get to your end goal. This is where utilising the power of your networks and using Social Media can come in handy. If you are interested in working somewhere why not proactively take the opportunity to research the industry or company - find out who it is you need to speak to and get in touch with them. We spend so much time working, we should enjoy the work we do and not be afraid to try new things. Waiting for your dream job to fall into your lap or be handed to you on a silver platter is not likely going to happen, so if there is something you do want to do, work out a plan to make it happen and chase after it. This article was originally posted on David Talamelli's Blog - David's Journal on Tap

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >