Search Results

Search found 6630 results on 266 pages for 'cname record'.

Page 181/266 | < Previous Page | 177 178 179 180 181 182 183 184 185 186 187 188  | Next Page >

  • Getting the primary key back from a SQL insert with SQLLite

    - by Paul Nathan
    Hi, I have a SQL table set that looks like this create table foo ( id int primary key asc, data datatype ); create table bar ( id int primary key asc, fk_foo int, foreign key(foo_int) references foo(id)); Now, I want to insert a record set. insert into table foo (data) values (stuff); But wait - to get Bar all patched up hunkydory I need the PK from Foo. I know this is a solved problem. What's the solution?

    Read the article

  • A table that has relation to itself issue

    - by Mostafa
    Hi , I've defined table with this schema : CREATE TABLE [dbo].[Codings]( [Id] [int] IDENTITY(1,1) NOT NULL, [ParentId] [int] NULL, [CodeId] [int] NOT NULL, [Title] [nvarchar](50) COLLATE Arabic_CI_AI NOT NULL, CONSTRAINT [PK_Codings] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] And fill it up with data like this : Id ParentId CodeId Title ----------- ----------- ----------- ---------- 1 NULL 0 Gender 2 1 1 Male 3 1 2 Female 4 NULL 0 Educational Level 5 4 1 BS 6 4 2 MS 7 4 3 PHD Now , I'm looking for a solution , in order , When i delete a record that is parent ( like Id= 1 or 4 ), It delete all child automatically ( all records that their ParentId is 1 or 4 ) . I supposed i can do it via relation between Id and Parent Id ( and set cascade for delete rule ) , But when i do that in MMS , the Delete Rule or Update Rule in Properties is disabled . My question is , What can i do to accomplish this ? Thank you

    Read the article

  • Two Tables Serving as one Model in Rails

    - by matsko
    Is is possible in rails to setup on model which is dependant on a join from two tables? This would mean that for the the model record to be found/updated/destroyed there would need to be both records in both database tables linked together in a join. The model would just be all the columns of both tables wrapped together which may then be used for the forms and so on. This way when the model gets created/updated it is just one form variable hash that gets applied to the model? Is this possible in Rails 2 or 3?

    Read the article

  • Algorithm for Search page

    - by Geetha
    Hi All, I am creating a search page where we can find the product by entering the text. ex: Brings on the night. My query bring the records which contain atleast word from this. Needs: 1. First row should contains the record with the given sentence. 2. Second most matching....etc How to achieve this. Is there any algorithm for this. It will be more helpful if anyone share your idea. Geetha

    Read the article

  • try catch finally

    - by gligom
    Maby this is simple for you, but for me is not. I have this code: Private int InsertData() { int rezultat = 0; try { if (sqlconn.State != ConnectionState.Open) { sqlconn.Open(); } rezultat = (int)cmd.ExecuteScalar(); } catch (Exception ex) { lblMesaje.Text = "Eroare: " + ex.Message.ToString(); } finally { if (sqlconn.State != ConnectionState.Closed) { sqlconn.Close(); } } return rezultat; } Is just for inserting a new record in a table. Even if this throw an error "Specified cast is not valid." "rezultat=(int)cmd.ExecuteScalar();" - the code is executed and the row is inserted in the database, and the execution continues. Why it continues? Maby i don't understand the try catch finally yet Smile | :) Thank you!

    Read the article

  • Vb.net on running shows updation exception

    - by harun123
    I've a website in vb.net. While running the website i get the following error: "Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype." My DB connection.inc file looks as follows: <%@ Import namespace="ADODB" % Dim strDataSource As String Dim cnnCRM As ADODB.Connection <% cnnCRM = New ADODB.Connection strDataSource = Server.MapPath(".") & "/database/crm.mdb" 'strDataSource="c://crm/crm.mdb" cnnCRM.Open("PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strDataSource) % I've tried giving the record set object all the properties it required. Still the same error. Can anybody tell me how i can get rid of this error?.....

    Read the article

  • WiX: Extracting Binary-string in Custom Action yields string like "???good data"

    - by leiflundgren
    I just found a weird behaviour when attempting to extract a string from the Binary-table in the MSI. I have a file containing "Hello world", the data I get is "???Hello world". (Literary question mark.) Is this as intended? Will it always be exactly 3 characters in the beginning? Regards Leif Sample code: [CustomAction] public static ActionResult CustomAction2(Session session) { View v = session.Database.OpenView("SELECT `Name`,`Data` FROM `Binary`"); v.Execute(); Record r = v.Fetch(); int datalen = r.GetDataSize("Data"); System.IO.Stream strm = r.GetStream("Data"); byte[] rawData = new byte[datalen]; int res = strm.Read(rawData, 0, datalen); strm.Close(); String s = System.Text.Encoding.ASCII.GetString(rawData); // s == "???Hello World" return ActionResult.Success; }

    Read the article

  • Problem evaluating NULL in an IIF statement (Access)

    - by Mohgeroth
    Item in the recordset rstImportData("Flat Size") is = Null With that, given the following statement: IIF(IsNull(rstImportData("Flat Size")), Null, cstr(rstImportData("Flat Size"))) Result: Throws error 94: Invalid use of Null If I change the statement by removing the type conversion upon a false comparison: IIF(IsNull(rstImportData("Flat Size")), Null, 0) Result: Null It returns Null as it should have the first time. It appears that I cannot do a type conversion in an IIF if the value passed in should ever be null even if it passes an IIF test, it still attempts to evaluate it at both the true and false answer. The only reason I'm using IIF like this is because I have a 25 line comparison to compare data from an Import against a matching record in a database to see if I need to append the prior to history. Any thoughts? The way data is imported there will be null dates and where the spreadsheet import is in a string format I must convert either side to the other to compare the values properly but if either side is null this exception occurs :(

    Read the article

  • XML, XPATH adding values

    - by user575373
    hello, i have XML files which contain records with the following structure: <payment contractType="1"> <income type="0"> <gr code="1" amount="1506.00"/> <gr code="4" amount="35.00"/> <gr code="10" amount="288.14"/> <de code="3011300" amount="138.72"/> <de code="3081100" amount="48.81"/> <de code="3082400" amount="109.84"/> </income> <netAmount1 value="765.00"/> <netAmount2 value="765.00"/> </payment> each file has many records of type payment and i want the final xml to contain one payment record by adding all the amount values for every differrent code value I think XPath can be used for this, but I never used it before , could someone show me some Java (or else) code for this?

    Read the article

  • Scala class to implement two Java Interfaces - how?

    - by puudeli
    Hi, I have just started learning Scala and I'm now wondering how I could implement two different Java interfaces with one Scala class? Let's say I have the following interfaces written in Java public interface EventRecorder { public void abstract record(Event event); } public interface TransactionCapable { public void abstract commit(); } But a Scala class can extend only one class at a time. How can I have a Scala class that could fulfill both contracts? Do I have to map those interfaces into traits? Note, my Scala classes would be used from Java as I am trying to inject new functionality written in Scala into an existing Java application. And the existing framework expects that both interface contracts are fulfilled.

    Read the article

  • Django says the "id may not be NULL" but why is it?

    - by Oli
    I'm going crazy today. I just tried to insert a new record and it threw back a "post_blogpost.id may not be NULL" error. Here's my model: class BlogPost(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=100) who = models.ForeignKey(User, default=1) when = models.DateTimeField() intro = models.TextField(blank=True, null=True) content = models.TextField(blank=True, null=True) counter = models.PositiveIntegerField(default=0) published = models.BooleanField(default=False) css = models.TextField(blank=True, null=True) class Meta: ordering = ('-when', 'id') There are a number of functions beneath the model too but I won't include them in full here. Their names are: content_cache_key, clear_cache, __unicode__, reads, read, processed_content. I'm adding through the admin... And I'm running out of hair.

    Read the article

  • AuthLogic perishable_token resets on every request

    - by go minimal
    In my User model I have: acts_as_authentic do |c| c.perishable_token_valid_for = 30.minutes end In my Application Controller I have the standard boilerplate code: def current_user_session return @current_user_session if defined?(@current_user_session) @current_user_session = UserSession.find end def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session.record end Now in my view I need to see if a user is logged in: <% if current_user %> Sign Out <% else %> Sign In <% end %> On every single request, current_user is being called, and that causes a SELECT call to be made to the database to find the user, then an UPDATE call that updates the last_request_at and perishable_token even though I set perishable_token_valid_for = 30.minutes. Does anyone have a better way to see if a user is logged in without causing a SELECT and UPDATE on every single page of my app. Does anyone know why the perishable token keeps updating even if I set it to be valid for 30 minutes???

    Read the article

  • Asp.Net MVC best way to update cached table

    - by Eddy Mishiyev
    There are certain tables that get called often but updated rarely. One of these tables is Departments. So to save DB trips, I think it is ok to cache this table taking into consideration that the table has very small size. However, once you cached it an issue of keeping the table data fresh occurs. So what is the best way to determine that the table is dirty and therefore requires a reload and how that code should be invoked. I look for solution that will be scalable. So updating the cache right after inserting will not work. So if one machine inserted the record all other on network should get notified to reload the cache. I was thinking for calling corresponding web service from T-SQL but don't really like the idea of consuming recourses on sql server. So what are the best practices to resolve this type of problems. Thanks in advance Eddy

    Read the article

  • bad performance from too many caught errors?

    - by Christopher Klein
    I have a large project in C# (.NET 2.0) which contains very large chunks of code generated by SubSonic. Is a try-catch like this causing a horrible performance hit? for (int x = 0; x < identifiers.Count; x++) {decimal target = 0; try { target = Convert.ToDecimal(assets[x + identifiers.Count * 2]); // target % } catch { targetEmpty = true; }} What is happening is if the given field that is being passed in is not something that can be converted to a decimal it sets a flag which is then used further along in the record to determine something else. The problem is that the application is literally throwing 10s of thousands of exceptions as I am parsing through 30k records. The process as a whole takes almost 10 minutes for everything and my overall task is to improve that time some and this seemed like easy hanging fruit if its a bad design idea. Any thoughts would be helpful (be kind, its been a miserable day) thanks, Chris

    Read the article

  • Fastest way to calculate summary of database field

    - by Jo-wen
    I have a ms-sql table with the following structure: Name nvarchar; Sign nvarchar; Value int example contents: Test1, 'plus', 5 Test1, 'minus', 3 Test2, 'minus', 1 I would like to have totals per "Name". (add when sign = plus, subtract when sign = minus) result: Test1, 2 Test2, -1 I want to show these results (and update them when a new record is added)... and I'm looking for the fastest solution! [sproc? fast-forward cursor? calculate in .net?]

    Read the article

  • Why is my computer not showing a speedup when I use parallel code?

    - by Jared P
    So I realize this question sounds stupid (and yes I am using a dual core), but I have tried two different libraries (Grand Central Dispatch and OpenMP), and when using clock() to time the code with and without the lines that make it parallel, the speed is the same. (for the record they were both using their own form of parallel for). They report being run on different threads, but perhaps they are running on the same core? Is there any way to check? (Both libraries are for C, I'm uncomfortable at lower layers.) This is super weird. Any ideas?

    Read the article

  • iPhone - finding items in current entity that share related item

    - by Pedro
    G'day Folks My core data driven app has an Events entity, essentially a list of times & venues, with a related Acts entity, the names & bios of the acts appearing at those events. I have a table view that shows the event time & venue (as a table section with 1 row), the act name & act bio that works nicely. If that act is appearing at more than one event I'd like to include another table section that lists those events. I think could get that with event.act.events except that it would include the event I'm currently displaying. Can anyone suggest how to get the data I want & exclude the current record? Cheers & TIA, Pedro :) PS... I have not quite 18 hours until the promised time for a prototype of my app to be available for some testers to download.

    Read the article

  • Convert Audio File to text using System.Speech

    - by Kushal Kalambi
    I am looking to convert a .wav file recorded through an android phone at 16000 to text using C#; namely the System.Speech namespace. My code is mentioned below; recognizer.SetInputToWaveFile(Server.MapPath("~/spoken.wav")); recognizer.LoadGrammar(new DictationGrammar()); RecognitionResult result = recognizer.Recognize(); label1.Text = result.Text; The is working perfectly with sample .wav "Hello world" file. However when i record something on teh phone and try to convert to on the pc, the converted text is no where close to what i had recoreded. Is there some way to make sure the audio file is transcribed accurately?

    Read the article

  • Why Jmeter is not recoring?

    - by Monika
    I am working with Jmeter2.3.2 version and trying to record a webpage. I have added http proxy server under workbench and added http request default under thread group. using port 9090 and target controller test plan - thread group. grouping - do not group samplers. After this setting i have started proxy server and opened internet browser selected manual proxy setting and added address as localhost with port 9090. the issue is Jmeter is nopt recoring anything. Please suggest it is urgent.

    Read the article

  • LINQ to SQL: Issue with concurrency

    - by Gib
    I’m working on a sandwich ordering app in ASP.NET MVC, C# and LINQ to SQL. The app revolves around the user creating multiple custom-made sandwiches from a selection of ingredients. When it comes to confirming the order I need to know that there’s enough portions of each ingredient to fulfil all the sandwiches in the user’s order before I commit to the DB as it is possible that an ingredient will go out of stock between adding it to their basket and confirming the order. A bit about the database: Ingredient – Stores ingredient details including number of portions Order – Header table for an order, simply stores the order time OrderDetail – Stores a record of each sandwich in an order OrderDetailItem – Stores each ingredient in each sandwich in an order So basically I’m wondering what the best approach to ensuring that before I add records to Order, OrderDetail and OrderDetailItem I can ensure that the order can be met.

    Read the article

  • In SQL, in what situation do we want to Index a field in a table, or 2 fields in a table at the same

    - by Jian Lin
    In SQL, it is obvious that whenever we want to do a search on millions of record, say CustomerID in a Transactios table, then we want to add an index for CustomerID. Is another situation we want to add an index to a field when we need to do inner join or outer join using that field as a criteria? Such as Inner join on t1.custumerID = t2.customerID. Then if we don't have an index on customerID on both tables, we are looking at O(n^2) because we need to loop through the 2 tables sequentially. If we have index on customerID on both tables, then it becomes O( (log n) ^ 2 ) and it is much faster. Any other situation where we want to add an index to a field in a table? What about adding index for 2 fields combined in a table. That is, one index, for 2 fields together?

    Read the article

  • Adding DataAnnontations to Generated Partial Classes

    - by Naz
    Hi I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class. I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this. public partial class User { [DataType(DataType.EmailAddress, ErrorMessage = "Please enter an email address")] public string Email { get; set; } ... } That examples gives the "Member is already defined" error. I think I might have seen an example a while ago of what I'm trying to do with Dynamic Data and Linq2Sql.

    Read the article

  • Ideas on simulating webservices for local automated testing.

    - by novice123
    I am testing an app, which talks to different webservices over the internet. For my automated testing, I don't want to go over the network. To achieve this, I need to simulate the webservice on my machine using another app. My initial thought is to record all the requests and responses between client and webservice, and then just write a simulation app which replays these responses. The disadvantage here is that everytime the webservice protocol changes a bit, I have to modify all my recorded resposnes. so I am looking to see if there are more elegant solutions. have anyone solved a similar problem? any thoughts, suggestion are appreciated.

    Read the article

  • iPhone: Cannot get simulator to generate .gcda profiling data files.

    - by Derek Clarkson
    I'm attempting to profile my code using the iPhone simulator. I've enabled Generate Test Coverage File and Instrument Program Flow and added -lgcov to the linker flags. According to everything I've read that should be all I need to do in terms of setup. Executing the program I can see the .gcno files appearing along side the .o compiled code in the build/.build/Debug-iphonesimulator/.build/Objects-normal/i386 directory. But when I run the app in the simulator I do not get any *.gcda files appearing. My understanding is that these files contain the data from the instrumentation. But I cannot find them anywhere on the computer. I know they can be produced and appear along side the *.gcno files because I have an old trashed buil directory which does have them. I just cannot figure out what I have to do to get them to appear and record the run. Any help appreciated.

    Read the article

  • How to debug when CakePHP Model::save() doesn't attempt an INSERT

    - by RyOnLife
    I am having a bear of a time saving the simplest record from a model called ItemView: if($this->save($this->data)) { echo 'worked'; } else { echo 'failed'; } Where $this-data is: Array ( [ItemView] => Array ( [list_id] => 1 [user_id] => 1 ) ) And my table is: CREATE TABLE IF NOT EXISTS `item_views` ( `id` int(11) NOT NULL auto_increment, `list_id` int(11) NOT NULL, `user_id` int(11) default NULL, `user_ip` int(10) unsigned default NULL, `created` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED AUTO_INCREMENT=1 ; Looking at the query dump in debug mode, Cake isn't even attempting an INSERT, so I have no idea how to debug. Any help would be appreciated.

    Read the article

< Previous Page | 177 178 179 180 181 182 183 184 185 186 187 188  | Next Page >