Search Results

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

Page 74/266 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • C# LINQ to XML missing space character.

    - by Fossaw
    I write an XML file "by hand", (i.e. not with LINQ to XML), which sometimes includes an open/close tag containing a single space character. Upon viewing the resulting file, all appears correct, example below... <Item> <ItemNumber>3</ItemNumber> <English> </English> <Translation>Ignore this one. Do not remove.</Translation> </Item> ... the reasons for doing this are various and irrelevent, it is done. Later, I use a C# program with LINQ to XML to read the file back and extract the record... XElement X_EnglishE = null; // This is CRAZY foreach (XElement i in Records) { X_EnglishE = i.Element("English"); // There is only one damned record! } string X_English = X_EnglishE.ToString(); ... and test to make sure it is unchanged from the database record. I detect a change, when processing Items where the field had the single space character... +E+ Text[3] English source has been altered: Was: >>> <<< Now: >>><<< ... the and <<< parts I added to see what was happening, (hard to see space characters). I have fiddled around with this but can't see why this is so. It is not absolutely critical, as the field is not used, (yet), but I cannot trust C# or LINQ or whatever is doing this, if I do not understand why it is so. So what is doing that and why?

    Read the article

  • MS Access form_current() firing multiple times

    - by Eric G
    I have a form with two subforms (on separate tab pages). It's an MDB project in Access 2003. When it initially opens, Form_Current on the active subform fires once, as it should. But when you move to another record (ie. from the main form), it fires Form_Current on the active subform 4 times. Then subsequent record-moves result in Form_Current firing 2 times. This is a pain, because the subforms have a lot of fields that get moved and/or hidden and so it jumps around for every Form_Current, not to mention being slow. I am opening the form with a filter via DoCmd.OpenForm (actually it sends the filter in via OpenArgs). FilterOn is only set once, in Form_Open on the main form, never in the subforms. Form_Current is not called explicitly anywhere else in the code. When I look at the call stack when Form_Current fires moving the first time, it looks like: my_subform.Form_Current [<Debug Window>] my_subform.Form_Current So it seems like something in Form_Current is triggering another Form_Current event. But only on the first record move. The code in Form_Current is somewhat complex, involving custom classes and event callbacks, but generally does not touch the table data. The only thing I can think might be triggering a Form_Current is that it checks OldValue on form controls - could this be causing it? Or anything else come to mind? Thanks. Eric

    Read the article

  • Jquery insertAfter() doesn't seem to work for me...

    - by Pandiya Chendur
    I have created a parent div and inserted div's after the parent div using jquery insertAfter() method.... What happens is My first record goes to the bottom and next record gets inserted above it.... Here is my function... function Iteratejsondata(HfJsonValue) { var jsonObj = eval('(' + HfJsonValue + ')'); for (var i = 0, len = jsonObj.Table.length; i < len; ++i) { var employee = jsonObj.Table[i]; $('<div class="resultsdiv"><br /><span id="EmployeeName" style="font-size:125%;font-weight:bolder;">' + employee.Emp_Name + '</span><span style="font-size:100%;font-weight:bolder;padding-left:100px;">Category&nbsp;:</span>&nbsp;<span>' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" style="font-size:100%;font-weight:bolder;">Salary Basis&nbsp;:</span>&nbsp;<span>' + employee.SalaryBasis + '</span><span style="font-size:100%;font-weight:bolder;padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span>' + employee.FixedSalary + '</span><span style="font-size:100%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span>' + employee.Address + '</span></div>').insertAfter('#ResultsDiv'); } } And my result is, Palani must be next to my parent div but it is at the bottom... Because insertAfter() inserts every record next to the #ResultsDiv ... Any suggestion how to insertafter the newly generated div...

    Read the article

  • Logical file not working for SUBFILE/SETLL?

    - by user1516536
    I'm using three logical file with different Record Format where on the first subfile I'm using LF1 and LF2 where on the first subfile I cannot use *LOVAL SETLL it will give me Run Time Error. not sure why? then the program will lead me to second subfile and I'm using LF3 it seems fine. but then If I back to first subfile the subfile turn to blanks.???? why? this my subroutine for building my subfile: C CLRSR BEGSR C EVAL *IN55='0' C WRITE USQLSCTL C EVAL *IN55='1' C ENDSR C* C*BUILDING SUBFILE C BLDSR BEGSR C *LOVAL SETLL USRLGX C EVAL RECNO=0 C EXSR TMISR1 C EXSR REDSR1 C DOW NOT %EOF C IF USRID<>IDD C EXSR MVESR C EXSR DIMSR C MOVE USRID IDD C EVAL RECNO=RECNO+1 C WRITE USQLS C ENDIF C EXSR TMISR1 C EXSR REDSR1 C ENDDO C ENDSR and the related subroutine C TMISR1 BEGSR C READ USRLGX C MOVE USRTI MINTI C ENDSR C REDSR1 BEGSR C READ USRLG C MOVE USRTO MAXTO C ENDSR 6 n the LF I used is USRLG and USRLGX. where both LF refer to the same record format. but each LF has different sorted order. *record format has been RENAME on F-Spec I have this two problem which is: I only can use *LOVAL setll logical-file once only. n the result for coding above sometime it will give result for UserTimeIn some time it equals to blanks.(000000)

    Read the article

  • ASP.NET MVC: How to validate an Ajax form with a specified UpdateTargetID?

    - by Bryan Roth
    I'm trying to figure out how to show validation errors after a user submits an Ajax form that has its UpdateTargetID property set. I'm stumped on how to update the Ajax form with the validation errors without returning the Create PartialView into the results div. If the form is valid, then it should return the Records PartialView. Create.ascx <% Using Ajax.BeginForm("Create", "Record", New Record With {.UserID = Model.UserID}, New AjaxOptions With { .UpdateTargetId = "results", .LoadingElementId = "loader" })%> Date Located <%= Html.TextBoxFor(Function(model) model.DateLocated)%> <%= Html.ValidationMessageFor(Function(model) model.DateLocated) %> Description <%= Html.TextBoxFor(Function(model) model.Description)%> <%= Html.ValidationMessageFor(Function(model) model.Description) %> <input id="btnSave" type="submit" value="Create" /> <span id="loader" class="loader">Saving...</span> <%End Using%> Records.ascx <div id="results"> ... </div> RecordController.vb Function Create(ByVal newRecord As Record) As ActionResult ValidateRecord(newRecord) If Not ModelState.IsValid Then Return PartialView("Create", newRecord) End If _repository.Add(newRecord) _repository.Save() Dim user = _repository.GetUser(newRecord.UserID) Return PartialView("Records", user) End Function

    Read the article

  • how to access a type defined in one .ml file in another .ml file

    - by user339261
    Hi, I m very new to ocaml and i m facing the problem below, In a.ml a record type t is defined and is also defined transparently in a.mli, i.e. in d interface so that the type definition is available to all other files. a.ml also has a function, func, which returns a list of t. Now in another file, b.ml i m calling func, now obviously ocaml compiler wud nt be able to infer d type of objects stored in d list, for compiler its just a list. so in b.ml, i hav something like dis, let tlist = A.func in let vart = List.hd tlist in printf "%s\n" vart.name (name is a field in record t) Now here i get a compiler error sayin "Unbound record field label name" which makes sense as compiler can't infer d type of vart. my first question: how do I explicitly provide d type of vart as t here? i tried doing "let vart:A.t = " but got the same error. I also tried creating another function to fetch the first element of d list and mentioning return type as A.t, but then i got the "Unbound value A.t". I did this: let firstt = function [] - 0 | x :: _ - A.t x ;; The problem is compiler is unable to recognize A.t (a type) in b.ml but is able to recognize function A.func. If I remove A.t from the b.ml, i don'get any compiler errors. Please help, its urgent work. Thanks in advance! ~Tarun

    Read the article

  • How to Set Customer Table with Multiple Phone Numbers? - Relational Database Design

    - by user311509
    CREATE TABLE Phone ( phoneID - PK . . . ); CREATE TABLE PhoneDetail ( phoneDetailID - PK phoneID - FK points to Phone phoneTypeID ... phoneNumber ... . . . ); CREATE TABLE Customer ( customerID - PK firstName phoneID - Unique FK points to Phone . . . ); A customer can have multiple phone numbers e.g. Cell, Work, etc. phoneID in Customer table is unique and points to PhoneID in Phone table. If customer record is deleted, phoneID in Phone table should also be deleted. Do you have any concerns on my design? Is this designed properly? My problem is phoneID in Customer table is a child and if child record is deleted then i can not delete the parent (Phone) record automatically.

    Read the article

  • The Select query I am using is not working.. Can Somebody Guide me to the Correct way?

    - by Parth
    I am using the Select query as SELECT id, ordering FROM `jos_menu` WHERE ordering='".$rec['ordering'] -'1' ."' AND parent = '0' Here I need all the records whose ordering is less than 1 of the selected record's order($rec['ordering'] = getting from other select query ) when I am trying to echo the query I am not getting complete statement but getting only this -1' AND parent = '0' here is the whole snippet $where = ' WHERE (id = ' . implode( ' OR id = ', $cid ) . ')';//Pranav Dave Coded echo $selquery = "SELECT id, ordering FROM `jos_menu`".$where; //Pranav Dave Coded $db->setQuery( $selquery );//Pranav Dave Coded $record = $db->loadAssocList(); //Pranav Dave Coded if ($model->orderItem($id, -1)) { echo "<pre>"; print_r($model); /*exit;*/ //echo $updorderup = mysql_escape_string($model->_db->_sql);//Pranav Dave Coded foreach($record as $rec)//Pranav Dave Coded { echo $aboverow = "SELECT id, ordering FROM `jos_menu` WHERE ordering='".$rec['ordering'] -'1' ."' AND parent = '0'"; $db->setQuery( $aboverow ); $above = $db->loadAssoc(); echo "<pre>"; print_r($above); }//end of foreach }//end of if Please suggest me where I am getting wrong.....

    Read the article

  • Syncing data between devel/live databases in Django

    - by T. Stone
    With Django's new multi-db functionality in the development version, I've been trying to work on creating a management command that let's me synchronize the data from the live site down to a developer machine for extended testing. (Having actual data, particularly user-entered data, allows me to test a broader range of inputs.) Right now I've got a "mostly" working command. It can sync "simple" model data but the problem I'm having is that it ignores ManyToMany fields which I don't see any reason for it do so. Anyone have any ideas of either how to fix that or a better want to handle this? Should I be exporting that first query to a fixture first and then re-importing it? from django.core.management.base import LabelCommand from django.db.utils import IntegrityError from django.db import models from django.conf import settings LIVE_DATABASE_KEY = 'live' class Command(LabelCommand): help = ("Synchronizes the data between the local machine and the live server") args = "APP_NAME" label = 'application name' requires_model_validation = False can_import_settings = True def handle_label(self, label, **options): # Make sure we're running the command on a developer machine and that we've got the right settings db_settings = getattr(settings, 'DATABASES', {}) if not LIVE_DATABASE_KEY in db_settings: print 'Could not find "%s" in database settings.' % LIVE_DATABASE_KEY return if db_settings.get('default') == db_settings.get(LIVE_DATABASE_KEY): print 'Data cannot synchronize with self. This command must be run on a non-production server.' return # Fetch all models for the given app try: app = models.get_app(label) app_models = models.get_models(app) except: print "The app '%s' could not be found or models could not be loaded for it." % label for model in app_models: print 'Syncing %s.%s ...' % (model._meta.app_label, model._meta.object_name) # Query each model from the live site qs = model.objects.all().using(LIVE_DATABASE_KEY) # ...and save it to the local database for record in qs: try: record.save(using='default') except IntegrityError: # Skip as the record probably already exists pass

    Read the article

  • C# LINQ to XML nissing space character.

    - by Fossaw
    I write an XML file "by hand", (i.e. not with LINQ to XML), which sometimes includes an open/close tag containing a single space character. Upon viewing the resulting file, all appears correct, example below... <Item> <ItemNumber>3</ItemNumber> <English> </English> <Translation>Ignore this one. Do not remove.</Translation> </Item> ... the reasons for doing this are various and irrelevent, it is done. Later, I use a C# program with LINQ to XML to read the file back and extract the record... XElement X_EnglishE = null; // This is CRAZY foreach (XElement i in Records) { X_EnglishE = i.Element("English"); // There is only one damned record! } string X_English = X_EnglishE.ToString(); ... and test to make sure it is unchanged from the database record. I detect a change, when processing Items where the field had the single space character... +E+ Text[3] English source has been altered: Was: >>> <<< Now: >>><<< ... the and <<< parts I added to see what was happening, (hard to see space characters). I have fiddled around with this but can't see why this is so. It is not absolutely critical, as the field is not used, (yet), but I cannot trust C# or LINQ or whatever is doing this, if I do not understand why it is so. So what is doing that and why?

    Read the article

  • C# Multi CheckboxList update inserts checked records but doesn't delete unchecked records

    - by DLL
    I have a multi checkboxlist on a formview. Both use queries in a tableadapter. I'm using VS 2012. When the user updates the form, I use the following code to update the checkbox data. If a user checks a new box, a new record is inserted correctly, however if the user unchecks a box the existing record is not deleted. The delete query works fine if I run it from the query builder in the table adapter, it's reaching the expected line in the code correctly, all values are correct and I receive no errors. I use a similar query to delete records when the form level data is deleted which works fine. The very last line is the one that doesn't work. Query: DELETE FROM [SLA_Categories] WHERE (([SLA_ID] = @SLA_ID) AND ([Choice_ID] = @Choice_ID)) protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { if (FormView1.DataKey.Value != null) { Categs = (CheckBoxList)FormView1.FindControl("CheckBoxList1"); CurrentSLA_ID = (int)FormView1.DataKey.Value; } if (CurrentSLA_ID > 0) { foreach (ListItem li in Categs.Items) { // See if there's a record for the current sla in this category int CurrentChoice_ID = Convert.ToInt32(li.Value); SLADataSetTableAdapters.SLA_CategoriesTableAdapter myAdapter; myAdapter = new SLADataSetTableAdapters.SLA_CategoriesTableAdapter(); int myCount = (int)myAdapter.FindCategoryBySLA_IDAndChoice_ID(CurrentSLA_ID, CurrentChoice_ID); // If this category is checked and there is not an existing rec, insert one if (li.Selected == true && myCount < 1) { // Insert a rec for this sla myAdapter.InsertCategory(CurrentChoice_ID, CurrentSLA_ID); } // If this category is unchecked and there is and existing rec, delete it if (li.Selected == false && myCount > 0) { // Delete this rec myAdapter.DeleteCategoryBySLA_IDAndChoice_ID(CurrentChoice_ID, CurrentSLA_ID); } } } }

    Read the article

  • MS Access 2003 - Save button enabling on form open on different tabs

    - by Justin
    I have a tab control on a form, and a couple different tabs have save buttons on them. Once the user saves data (via SQL statements in VBA), I set the .enabled = false so that they cannot use this button again until moving to a brand new record (which is a button click on the overall form). so when my form open i was going to reference a sub that enabled all these save buttons because the open event would mean new record. though i get an error that says it either does not exist, or is closed. any ideas? thanks EDIT: Sub Example() error handling Dim db as dao.database dim rs as dao.recordset dim sql as string SQL = "INSERT INTO tblMain (Name, Address, CITY) VALUES (" if not isnull (me.name) then sql = sql & """" & me.name & """," else sql = sql & " NULL," end if if not insull(me.adress) then sql = sql & " """ & me.address & """," else sql = sql & " NULL," end if if not isnull(me.city) then sql = sql & " """ & me.city & """," else sql = sql & " NULL," end if 'debug.print(sql) set db = currentdb db.execute (sql) MsgBox "Changes were successfully saved" me.MyTabCtl.Pages.Item("SecondPage").setfocus me.cmdSaveInfo.enabled = false and then on then the cmdSave needs to get re enabled on a new record (which by the way, this form is unbound), so it all happens when the form is re-opened. I tried this: Sub Form_Open() me.cmdSaveInfo.enabled = true End Sub and this is where I get the error stated above. So this is also not the tab that has focus when the form opens. Is that why I get this error? I cannot enable or disable a control when the tab is not showing?

    Read the article

  • add row to a BindingSource gives different autoincrement value from whats saved into DB

    - by Ruben Trancoso
    I have a DataGridView that shows list of records and when I hit a insert button, a form should add a new record, edit its values and save it. I have a BindingSource bound to a DataGridView. I pass is as a parameter to a NEW RECORD form so // When the form opens it add a new row and de DataGridView display this new record at this time DataRowView currentRow; currentRow = (DataRowView) myBindindSource.AddNew(); when user confirm to save it I do a myBindindSource.EndEdit(); // inside the form and after the form is disposed the new row is saved and the bindingsorce position is updated to the new row DataRowView drv = myForm.CurrentRow; avaliadoTableAdapter.Update(drv.Row); avaliadoBindingSource.Position = avaliadoBindingSource.Find("ID", drv.Row.ItemArray[0]); The problem is that this table has a AUTOINCREMENT field and the value saved may not correspond the the value the bindingSource gives in EDIT TIME. So, when I close and open the DataGridView again the new rowd give its ID based on the available slot in the undelying DB at the momment is was saved and it just ignores the value the BindingSource generated ad EDIT TIME, Since the value given by the binding source should be used by another table as a foreingKey it make the reference insconsistent. There's a way to get the real ID was saved to the database?

    Read the article

  • Sound does not working in Device

    - by diana
    In my app i write for record NSArray *filePaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *recordingDirectory = [filePaths objectAtIndex: 0]; NSString *resourcePath = [recordingDirectory stringByAppendingString:@"/sound.caf"]; self.soundFileURL = [NSURL fileURLWithPath:resourcePath]; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; audioSession.delegate = self; [audioSession setActive: YES error: nil]; [[AVAudioSession sharedInstance] setCategory : AVAudioSessionCategoryRecorderror: nil]; NSDictionary *recordSettings = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithFloat: 44100.0], AVSampleRateKey, [NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, [NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey, nil]; AVAudioRecorder *newRecorder = [[AVAudioRecorder alloc] initWithURL: soundFileURL settings: recordSettings error: nil]; [recordSettings release]; self.soundRecorder = newRecorder; [newRecorder release]; soundRecorder.delegate = self; [soundRecorder prepareToRecord]; [soundRecorder record]; recording = YES; I write for stop recording [soundRecorder stop]; recording = NO; self.soundRecorder = nil; I write for play AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: self.soundFileURL error: nil]; [fileURL release]; self.player = newPlayer; [newPlayer release]; [player prepareToPlay]; [player setDelegate: self]; [button setTitle : @"Pause"forState: UIControlStateHighlighted]; [button setTitle : @"Pause"forState: UIControlStateNormal]; [player play]; In iPhone Simulator all ok I record then stop then play and all work fine. But in my iPhone device no sound. Any help will be greatly apprecieated

    Read the article

  • How to display custom processing message in JQuery datatables

    - by Sukhi
    i am using datatables api to display data in my asp.net4.0 application; datatables I have one column [ Delete ] to delete the row data.when i click on this link i send a jquery ajax request to delete the row from database. I want to display a message such as [ Deleting record... ] to the end user until data deleted by server side processing. I put a div on my page and write a message [ Deleting record... ] in a div when i click on delete link i display that message but when delete operation complete it also display a message [ Processing... ](which is inbuilt message of datatables) which looks like odd as two message are displaying. What can i do better to display message to the end user. JSCode $('#tblVideoList .delete').live('click', function (e) { e.preventDefault(); var oTable = $('#tblVideoList').dataTable(); var aPos = oTable.fnGetPosition(this.parentNode); var aData = oTable.fnGetData(aPos[0]); if (confirm('Are you sure want to delete the record.')) { $("#divDelete").show(); var today = new Date(); $.ajax({ type: "GET", cache: false, url: "samplepage.aspx", success: function (msg) { $("#divDelete").hide(); oTable.fnDraw(); } }); } return false; }); Thanks

    Read the article

  • Addresses stored in SQL server have many small variations(errors)

    - by MAW74656
    I have a table in my database which stores packing slips and their information. I'm trying to query that table and get each unique address. I've come close, but I still have many near misses and I'm looking for a way to exclude these near duplicates from my select. Sample Data CompanyCode CompanyName Addr1 City State Zip 10033 UNITED DIE CUTTING & FINISHIN 3610 HAMILTON AVE CLEVELAND Ohio 44114 10033 UNITED DIE CUTTING & FINISHING 3610 HAMILTON AVE CLEVELAND Ohio 44114 10033 UNITED DIE CUTTING & FINISHING 3610 HAMILTON AVE. CLEVELAND Ohio 44114 10033 UNITED DIE CUTTING & FINISHING 3610 HAMILTON AVENUE CLEVELAND Ohio 44114 10033 UNITED DIECUTTING & FINISHING 3610 HAMILTON AVE CLEVELAND Ohio 44144 10033 UNITED FINISHING 3610 HAMILTON AVE CLEVLAND Ohio 44114 10033 UNITED FINISHING & DIE CUTTING 3610 HAMILTON AVE CLEVELAND Ohio 44114 And all I want is 1 record. Is there some way I can get the "Average" record? Meaning, if most of the records say CLEVELAND instead of CLEVLAND, I want my 1 record to say CLEVELAND. Is there any way to par this data down to what I'm looking for? Desired Output CompanyCode CompanyName Addr1 City State Zip 10033 UNITED DIE CUTTING & FINISHING 3610 HAMILTON AVE CLEVELAND Ohio 44114

    Read the article

  • ASP.net drop down dynamically styling and then remembering the styles on aborted submit

    - by peacedog
    So, I've got an ASP drop down list (this is .net 2.0). I'm binding it with data. Basically, when the page loads and it's not a post back we'll fetch record data, bind all the drop downs, and set them to their appropriate values (strictly speaking we: initialize page with basic set of data from DB, bind drop downs from DB, fetch actual record data from DB, set drown downs to appropriate settings at this time). What I want to do is selectively style the list options. So the database returns 3 items: ID, Text, and a flag indicating whether I the record is "active" (and I'll style appropriately). It's easy enough to do and I've done it. My problem is what happens when a form submission is halted. We have slightly extended the Page class and created an AddError() method, which will create a list of errors from failed business rule checks and then display them in a ValidationSummary. It works something like this, in the submit button's click event: CheckBizRules(); if(Page.IsValid) { SaveData(); } If any business rule check fails, the Page will not be valid. The problem is, when the page re-renders (viewsate is enabled, but no data is rebound) my beautiful conditional styling is now sadly gone, off to live in the land of the missing socks. I need to preserve it. I was hoping to avoid another DB call here (e.g. getting the list data back from the DB again if the page isn't valid, just for purposes of re-styling the list). But it's not the end of the world if that's my course of action. I was hoping someone might have an alternative suggestion. I couldn't think of how to phrase this question better, if anyone has any suggestions or needs clarification don't hesitate to get it, by force if need be. ;)

    Read the article

  • How Can I Create Reports in a Custom C#.NET Windows Application? - General Question

    - by user311509
    Assume i have a custom Windows application written in C#. This application has only the following functionalists, add, edit, delete and view. For example, a user can add a sale, change sales record, delete a sale record or view the whole sales record. I need to add some reporting functionalists e.g. i want a user to print the sales of a certain customer from 2008 to 2009 into pdf, what all products a certain customer has purchased from us and so on. I will only include the basic common report requests that are usually needed in the office. Any other kind of reports that are requested inconsistently, i would do it manually from my side at the back end and send the results manually to the requester. What i would do is: If a user wants more info of a certain customer, a special window box appears for that customer. This window box will have different controls that allows user to request more info such as, print customer purchases from ..... to ..... (user chooses the dates) and user will view results in pdf or so. Of course, at the back scene i will write an appropriate SQL Query with parameters that meets a certain function. Is this how it should be done? I have heard about SQL Reporting, i don't know anything about it yet. I will check it out. Anyhow, your suggestions won't harm. I'm still a student, so i don't have practical experience yet. I hope my question is clear enough. Thank you.

    Read the article

  • Problem with WHERE columnName = Data in MySQL query in C#

    - by Ryan Sullivan
    I have a C# webservice on a Windows Server that I am interfacing with on a linux server with PHP. The PHP grabs information from the database and then the page offers a "more information" button which then calls the webservice and passes in the name field of the record as a parameter. So i am using a WHERE statement in my query so I only pull the extra fields for that record. I am getting the error: System.Data.SqlClient.SqlException:Invalid column name '42' Where 42 is the value from the name field from the database. my query is string selectStr = "SELECT name, castNotes, triviaNotes FROM tableName WHERE name =\"" + show + "\""; I do not know if it is a problem with my query or something is wrong with the database, but here is the rest of my code for reference. NOTE: this all works perfectly when I grab all of the records, but I only want to grab the record that I ask my webservice for. public class ktvService : System.Web.Services.WebService { [WebMethod] public string moreInfo(string show) { string connectionStr = "MyConnectionString"; string selectStr = "SELECT name, castNotes, triviaNotes FROM tableName WHERE name =\"" + show + "\""; SqlConnection conn = new SqlConnection(connectionStr); SqlDataAdapter da = new SqlDataAdapter(selectStr, conn); DataSet ds = new DataSet(); da.Fill(ds, "tableName"); DataTable dt = ds.Tables["tableName"]; DataRow theShow = dt.Rows[0]; string response = "Name: " + theShow["name"].ToString() + "Cast: " + theShow["castNotes"].ToString() + " Trivia: " + theShow["triviaNotes"].ToString(); return response; } }

    Read the article

  • SQL query for selecting the firsts in a series by cloumn

    - by SP
    I'm having some trouble coming up with a query for what I am trying to do. I've got a table we'll call 'Movements' with the following columns: RecID(Key), Element(f-key), Time(datetime), Room(int) The table is holding a history of Movements for the Elements. One record contains the element the record is for, the time of the recorded location, and the room it was in at that time. What I would like are all records that indicate that an Element entered a room. That would mean the first (by time) entry for any element in a series of movements for that element in the same room. The input is a room number and a time. IE, I would like all of the records indicating that any Element entered room X after time Y. The closest I came was this Select Element, min(Time) from Movements where Time > Y and Room = x group by Element This will only give me one room entry record per Element though (If the Element has entered the room X twice since time Y I'll only get the first one back) Any ideas? Let me know if I have not explained this clearly. I'm using MS SQLServer 2005.

    Read the article

  • XSLT line counter - is it that hard?

    - by Mr AH
    I have cheated every time I've needed to do a line count in XSLT by using JScript, but in this case I can't do that. I simply want to write out a line counter throughout an output file. This basic example has a simple solution: <xsl:for-each select="Records/Record"> <xsl:value-of select="position()"/> </xsl:for-each> Output would be: 1 2 3 4 etc... But what if the structure is more complex with nested foreach's : <xsl:for-each select="Records/Record"> <xsl:value-of select="position()"/> <xsl:for-each select="Records/Record"> <xsl:value-of select="position()"/> </xsl:for-each> </xsl:for-each> Here, the inner foreach would just reset the counter (so you get 1, 1, 2, 3, 2, 1, 2, 3, 1, 2 etc). Does anyone know how I can output the position in the file (ie. a line count)?

    Read the article

  • Why qry.post executed with asynchronous mode?

    - by Ryan
    Recently I met a strange problem, see code snips as below: var sqlCommand: string; connection: TADOConnection; qry: TADOQuery; begin connection := TADOConnection.Create(nil); try connection.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.MDB;Persist Security Info=False'; connection.Open(); qry := TADOQuery.Create(nil); try qry.Connection := connection; qry.SQL.Text := 'Select * from aaa'; qry.Open; qry.Append; qry.FieldByName('TestField1').AsString := 'test'; qry.Post; beep; finally qry.Free; end; finally connection.Free; end; end; First, Create a new access database named test.mdb and put it under the directory of this test project, we can create a new table named aaa in it which has only one text type field named TestField1. We set a breakpoint at line of "beep", then lunch the test application under ide debug mode, when ide stops at the breakpoint line (qry.post has been executed), at this time we use microsoft access to open test.mdb and open table aaa you will find there are no any changes in table aaa, if you let the ide continue running after pressing f9 you can find a new record is inserted in to table aaa, but if you press ctrl+f2 to terminate the application at the breakpoint, you will find the table aaa has no record been inserted, but in normal circumstance, a new record should be inserted in to the table aaa after qry.post executed. who can explain this problem , it troubles me so long time. thanks !!! BTW, the ide is delphi 2010, and the access mdb file is created by microsoft access 2007 under windows 7

    Read the article

  • SQL Server: preventing dirty reads in a stored procedure

    - by pcampbell
    Consider a SQL Server database and its two stored procs: *1. A proc that performs 3 important things in a transaction: Create a customer, call a sproc to perform another insert, and conditionally insert a third record with the new identity. BEGIN TRAN INSERT INTO Customer(CustName) (@CustomerName) SELECT @NewID = SCOPE_IDENTITY() EXEC CreateNewCustomerAccount @NewID, @CustomerPhoneNumber IF @InvoiceTotal > 100000 INSERT INTO PreferredCust(InvoiceTotal, CustID) VALUES (@InvoiceTotal, @NewID) COMMIT TRAN *2. A stored proc which polls the Customer table for new entries that don't have a related PreferredCust entry. The client app performs the polling by calling this stored proc every 500ms. A problem has arisen where the polling stored procedure has found an entry in the Customer table, and returned it as part of its results. The problem was that it has picked up that record, I am assuming, as part of a dirty read. The record ended up having an entry in PreferredCust later, and ended up creating a problem downstream. Question How can you explicitly prevent dirty reads by that second stored proc? The environment is SQL Server 2005 with the default configuration out of the box. No other locking hits are given in either of these stored procedures.

    Read the article

  • Method works on Emulator but no on Microsoft Surface unit?

    - by Roflcoptr
    I have the following code. The StartRecord method trows an error on the Microsoft Surface Unit. But when I'm testing it on the emulator, it all works great. Any hints how 1) to find the exception that is thrown on the Microsoft Surface Unit? 2) to find the error in the code? any assumptions? private void StartRecord(object sender, ContactEventArgs e) { isRecording = true; StartButton.IsEnabled = false; recordTimer = new Timer(10); recordTimer.Elapsed += new ElapsedEventHandler(recordTimer_Elapsed); PlaybackRoot.Visibility = System.Windows.Visibility.Collapsed; EllapsedRecord.Visibility = System.Windows.Visibility.Visible; InputLevel.Visibility = System.Windows.Visibility.Visible; long time = DateTime.Now.Ticks; String fileName = Convert.ToString(time) + ".wav"; Console.WriteLine(fileName); startTime = DateTime.UtcNow; recordTimer.Start(); record = new AudioRecording(fileName); record.getSampleAggregator().MaximumCalculated += new EventHandler<MaxSampleEventArgs>(AudioControl_MaximumCalculated); record.start(); }

    Read the article

  • "Special case" records for foreign key constraints

    - by keithjgrant
    Let's say I have a mysql table, called foo with a foreign key option_id constrained to the option table. When I create a foo record, the user may or may not have selected an option, and 'no option' is a viable selection. What is the best way to differentiate between 'null' (i.e. the user hasn't made a selection yet) and 'no option' (i.e. the user selected 'no option')? Right now, my plan is to insert a special record into the option table. Let's say that winds up with an id of 227 (this table already has a number of records at this point, so '1' isn't available). I have no need to access this record at a database level, and it would act as nothing more than a placeholder that the foreign key in the foo table can reference. So do I just hard-code '227' in my codebase when I'm creating 'foo' records where the user has selected 'no option'? The hard-coded id seems sloppy, and leaves room for error as the code is maintained down the road, but I'm not really sure of another approach.

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >