exception

Why ExecuteNonQuery() returning -1 without any exception and without inserting the entry in database?

我的未来我决定 提交于 2019-12-25 05:15:43
问题 I have following function: public Exception createTopic(Topic t) { query = "insert into [DisData].[dbo].[discussions]([title],[description],[usrid],[dateadded],[desid],[likes],[shares],[visit],[replyto],[sno]) values(@title,@des,@uid,@dateadded,@did,@like,@share,@visit,@replyto,@sno)"; try { com = new SqlCommand(query, con); com.Parameters.AddWithValue("@title", t.getTitle()); com.Parameters.AddWithValue("@des", t.getDescription()); com.Parameters.AddWithValue("@uid", t.getUsrID()); com

Arraylist Sublist IndexOutOfBounds Exception

試著忘記壹切 提交于 2019-12-25 05:13:49
问题 Working on below code to Modify HL7 messages and add some Hex Characters depending on condition i have written. Copying the String from the textbox and converting it to Arraylist so that i can traverse through it to find the names of the HL7 segments. To do so i am getting a sublist out of Arraylist. But when working with below code i am getting IndexOutOf Bounds exception. I know that when searching for Sublist my search is exceeding the size of Arraylist. Just need a tip to check if the

Ada: Adding an exception in a separate procedure when reading a file

你。 提交于 2019-12-25 05:11:48
问题 This is a follow-up of this question: Ada: reading from a file . I would like to add an exception that checks if the file that I'm opening actually exists or not. I have made a separate procedure to avoid code clutter. Here is the main code test_read.adb : with Ada.Text_IO; use Ada.Text_IO; with Ada.Long_Float_Text_IO; with Ada.Float_Text_IO; procedure Test_Read is Input_File : File_Type; Value : Long_Float; procedure Open_Data (File : in Ada.Text_IO.File_Type; Name : in String) is separate;

Ada: Adding an exception in a separate procedure when reading a file

旧时模样 提交于 2019-12-25 05:11:23
问题 This is a follow-up of this question: Ada: reading from a file . I would like to add an exception that checks if the file that I'm opening actually exists or not. I have made a separate procedure to avoid code clutter. Here is the main code test_read.adb : with Ada.Text_IO; use Ada.Text_IO; with Ada.Long_Float_Text_IO; with Ada.Float_Text_IO; procedure Test_Read is Input_File : File_Type; Value : Long_Float; procedure Open_Data (File : in Ada.Text_IO.File_Type; Name : in String) is separate;

Which .net exception to throw when the server throws an unexpected exception via webservice

纵饮孤独 提交于 2019-12-25 05:08:33
问题 Which .net exception should throw the client (or better re-throw), if it catches any unexpected exception from the server (e.g. wrapped in as FaultException via WCF, the server can be written on java) to handle it further on client as follow: The client shows the user a message about the possible bug in client/server The client provides developers the details of this exception (e.g. per e-mail) Example in the business layer: var client = new MyWcfClient()); try { // Try get data. var data =

The SqlParameter is already contained by another SqlParameterCollection - command.Parameters.Clear() does not work

点点圈 提交于 2019-12-25 05:06:48
问题 I am getting desperate here. I cant figure out why does this exception occur. I searched and read about this problem and it seems everyone managed to solve it with command.Parameters.Clear(), but this does not work for me. Here is my code: public class ProductsDataAccess : Connection { public static SqlParameter[] createParams(Products prod) { SqlParameter idParam = new SqlParameter("@id", prod.prodID); idParam.SqlDbType = System.Data.SqlDbType.VarChar; idParam.Size = 45; idParam.IsNullable =

Weird Exception when placing a marker with LatLng

旧街凉风 提交于 2019-12-25 05:05:18
问题 I have this code that should place a marker on a map using LatLng ... geocoder = Geocoder.create(); myOptions = MapOptions.create(); myOptions.setZoom(18); myOptions.setMapTypeId(MapTypeId.HYBRID); myOptions.setMapMaker(true); map = GoogleMap.create( Document.get().getElementById("map_canvas"),myOptions); location = LatLng.create(45.48592686713835,-73.49009937672122); map.setCenter(location.getGeometry().getLocation()); marker = Marker.create(); marker.setMap(map); marker.setPosition(location

InputMismatchException Error

限于喜欢 提交于 2019-12-25 05:04:07
问题 I am receiving a compile time error saying: No exception of type InputMismatchException can be thrown; an exception type must be a subclass of Throwable InputMismatchException.java As far as I'm aware InputMismatchException is an exception thrown by the Scanner when it receives invalid input, why then is this error preventing me from compiling? import java.util.*; public class InputMismatchException { public static void main(String[] args) { boolean continueInput = true; Scanner input = new

security exception accessing registry when the program runs as scheduled task

余生长醉 提交于 2019-12-25 04:56:17
问题 the following small line throws a System.Security.SecurityException: Requested registry access is not allowed: RegistryKey _key = HKLM.OpenSubKey("path\\to\\my settings", false); Now.. what's the point some would ask? The point is that this runs ONLY when I am logged on . The exception is thrown if the program runs as scheduled task and nobody is logged on. the user who runs that task is local administrator the program does not run from a network share, it is located on the local disk I even

JavaFX TextArea with listener gives: “java.lang.IllegalArgumentException: The start must be <= the end”

旧街凉风 提交于 2019-12-25 04:42:12
问题 I am getting the exception when trying to change text in the text property listener. The exception is exactly the same is this question. I used TextArea instead of TextField, but I think the source of the bug is the same. It's in the "TextInputControl.java". It seems to be Java 8's bug. @FXML private TextArea ta; ta.setText("12-"); // pre-set text ta.textProperty().addListener((observable, oldValue, newValue) -> { ta.setText("1"); // changed text }); This causes the exception on my machine. I