Search Results

Search found 1372 results on 55 pages for 'userid'.

Page 6/55 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Sandcastle not adding param documentation

    - by rockinthesixstring
    My method looks as follows ''' <summary> ''' Adds the activity. ''' </summary> ''' <param name="userid">An that is derived from the <see cref="Domain.User.ID" /></param> ''' <param name="activity">The activity integer that is to be derived from the <see cref="ActivityLogService.LogType" />.</param> ''' <param name="ip">An IP V4 IP Address.</param>integer ''' <remarks></remarks> Public Sub AddActivity(ByVal userid As Integer, ByVal activity As Integer, ByVal ip As String) Implements IActivityLogService.AddActivity Dim _activity As ActivityLog = New ActivityLog _activity.Activity = activity _activity.UserID = userid _activity.UserIP = ip.IPAddressToNumber _activity.ActivityDate = DateTime.UtcNow ActivityLogRepository.AddActivity(_activity) End Sub But when I run Sandcastle, my documentation ends up looking like this userid Type: System..::..Int32 [Missing documentation for "M:myapp.Core.Domain.ActivityLogService.AddActivity(System.Int32,System.Int32,System.String)"] activity Type: System..::..Int32 [Missing documentation for "M:myapp.Core.Domain.ActivityLogService.AddActivity(System.Int32,System.Int32,System.String)"] ip Type: System..::..String [Missing documentation for "M:myapp.Core.Domain.ActivityLogService.AddActivity(System.Int32,System.Int32,System.String)"] What am I doing wrong?

    Read the article

  • Trigger for insert table

    - by shanks
    I have sql server 2005 and need to create trigger for insert query. I have Table naemd as "Log" with column named as UserID,UserName,LogDate,LogTime and want to transfer data into other table named as "DataTable" with same column name. I have created trigger GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER [dbo].[Transfer] on [dbo].[Log] AFTER INSERT AS BEGIN insert into DataTable (UserID,UserName,LogDate,LogTime) SELECT UserID,UserName,LogDate,LogTime FROM Log where UserID not in(select UserID from DataTable) END New Data is updated on daily basis in "Log" table and so i want to transfer new data from Log table to DataTable with trigger.Execution time is very high and so no output .

    Read the article

  • How to insert an integer into a database through command prompt

    - by jpavlov
    I am trying to insert a integer into a database in C# using the code below, but everytime I run the compiler informs me that my integer is not a valid column "Invalid Column Name UserID" Does anyone have any insight on this? Thanks. Console.WriteLine("Please enter a new User Id"); string line = Console.ReadLine(); int UserID; if (int.TryParse(line, out UserID)) { Console.WriteLine(UserID); Console.ReadLine(); } //Prepare the command string string insertString = @"INSERT INTO tb_User(ID,f_Name, l_Name) VALUES (UserID,'Ted','Turner')";

    Read the article

  • how to order a group result with Linq?

    - by Aaron
    How can I order the results from "group ... by... into..." statement in linq? For instance: var queryResult = from records in container.tableWhatever where records.Time >= DateTime.Today group records by tableWhatever.tableHeader.UserId into userRecords select new { UserID = userRecords.Key, Records = userRecords }; The query returns records in table "contain.tableWhatever" grouped by "UserId". I want the returned results within each group ordered by time decending. How can I do that? More specific, assume the above query return only one group like the following: {UserID = 1, Records= {name1 5/3/2010_7:10pm; name2 5/3/2010_8:10pm; name3 5/3/2010_9:10pm} } After insert the orderby statement in the above query, the returned results should be like this: {UserID = 1, Records= {name3 5/3/2010_9:10pm; name2 5/3/2010_8:10pm; name1 5/3/2010_7:10pm} } Thanks for help!

    Read the article

  • How to prune data set by frequency to conform to paper's description

    - by sakura90
    The MovieLens data set provides a table with columns: userid | movieid | tag | timestamp I have trouble reproducing the way they pruned the MovieLens data set used in: Tag Informed Collaborative Filtering, by Zhen, Li and Young In 4.1 Data Set of the above paper, it writes "For the tagging information, we only keep those tags which are added on at least 3 distinct movies. As for the users, we only keep those users who used at least 3 distinct tags in their tagging history. For movies, we only keep those movies that are annotated by at least 3 distinct tags." I tried to query the database: select TMP.userid, count(*) as tagnum from (select distinct T.userid as userid, T.tag as tag from tags T) AS TMP group by TMP.userid having tagnum >= 3; I got a list of 1760 users who labeled 3 distinct tags. However, some of the tags are not added on at least 3 distinct movies. Any help is appreciated.

    Read the article

  • Call Method from LinQ query.

    - by Jitendra Jadav
    Hello Everybody, I am using Linq query and call method Like.. oPwd = objDecryptor.DecryptIt((c.Password.ToString()) it will return null value. Means this will not working. how I Resolve this. Thanks.. var q = from s in db.User join c in db.EmailAccount on s.UserId equals c.UserId join d in db.POPSettings on c.PopSettingId equals d.POPSettingsId where s.UserId == UserId && c.EmailId == EmailId select new { oUserId = s.UserId, oUserName = s.Name, oEmailId = c.EmailId, oEmailAccId = c.EmailAccId, oPwd = objDecryptor.DecryptIt(c.Password.ToString()), oServerName = d.ServerName, oServerAdd = d.ServerAddress, oPOPSettingId = d.POPSettingsId, };

    Read the article

  • MySQL: INNER JOIN

    - by ABC
    I have a table which contains UserId & his Friends Id like: ---------------------------------------------- UserFriendsId | UserId | FriendId ---------------------------------------------- 1 1 2 ---------------------------------------------- 2 1 3 ---------------------------------------------- 3 2 1 ---------------------------------------------- 4 2 3 ---------------------------------------------- This table data shows that User-1 & User-2 are friend & they also have frndship with User-3. Now I want to find common friend(s) among UserId 1 & UserId 2 for eg: In sentance my query is: User 1 & User 2 have 1 common Friend FriendId 3. For this I used SQL query for INNER JOIN: SELECT t1.* FROM userfriends t1 INNER JOIN userfriends t2 ON t1.FriendId = t2.FriendId WHERE t1.UserId = 2 But not return required result..

    Read the article

  • SQL: Join Parent - Child tables

    - by pray4Mojo
    I'm building a simple review website application and need some help with SQL Query. There are 3 tables (Topics, Comments, Users). I need a SQL query to select the data from all 3 tables. The 'Topics' table is the parent and the 'Comments' table contains the child records (anywhere from zero to 100 records per parent. The third table 'Users' contains the user information for all users. Here are the fields for the 3 tables: Topics (topicID, strTopic, userID) Comments (commentID, topicID, strComment, userID) Users (userID, userName) I tried: SELECT * FROM Topics Inner Join Comments ON Topics.topicID = Comments.topicID Inner Join Users ON Topics.userID = Users.userID But this does not work correctly because there are multiple topics and the User info is not joined to the Comments table. Any help would be appreciated.

    Read the article

  • Sql join, 2 tables, same fields

    - by Lobuno
    I have 2 tables. To simplify: Table 1, users: userId int, userName nvarchar(50) Table 2 , messages: msgId int, msgFrom int, msgTo int... msg1 and msg2, both contain userId. Now I want to get all messages, but instead of the msgFrom I want the user name. I know what to do here: select tabMessages.*, tabUsers.userName as Sender from tabMessages inner join tabUsers on msgFrom=userId where msgId = @someParameter; Everything works fine and dandy. The same to get the user name instead of msgTo. Now the problem is, how do I do to get BOTH fields in the same call? I want to get the table as msgId, msgFrom, msgTo, Sender, Recipient. I have tried as: select tabMessages.*, tabUsers.userName as Sender, tabUsers.userName as Recipient from tabMessages inner join tabUsers on msgFrom=userId and msgTo=userId where msgId = @someParameter; but that doesn't work. I'm using Ms sql2000 by the way.

    Read the article

  • Getting mysql syntax error and cant find source

    - by eGGzy
    I have function that updates log table. function wslog($userID, $log, $where) { safe_query("INSERT INTO ".PREFIX."log ( time, userID, log, where ) values( '".time()."', '".$userID."', '".$log."', '".$where."' ) "); } And I have this php code: wslog($userID, 'server|'.mysql_insert_id().'', 'servers'); But I keep getting syntax error: Query failed: errorno=1064 error=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where ) values( '1269208030', '1', 'server|14', 'servers' )' at line 1 query=INSERT INTO ws_DII_log ( time, userID, log, where ) values( '1269208030', '1', 'server|14', 'servers' )

    Read the article

  • Use currently logged-in user in query

    - by Degan
    I am using VisualWebDeveloperExpress2008 with Access as the membership provider. I have some cases where I want users to edit their own data. This would involve a query where the UserId should equal the UserID of the user who is using the site. I am expecting to use WHERE UserId = ?, but I have not found out where to direct "?". The IDE gives several choices, but I am uncertain which to choose. This, while it looks promising does not work: <SelectParameters> <asp:ProfileParameter Name="UserID" PropertyName="UserId" Type="Int32" /> </SelectParameters> What is best to use for the Select Parameter?

    Read the article

  • Erlang: simple refactoring

    - by alexey
    Consider the code: f(command1, UserId) -> case is_registered(UserId) of true -> %% do command1 ok; false -> not_registered end; f(command2, UserId) -> case is_registered(UserId) of true -> %% do command2 ok; false -> not_registered end. is_registered(UserId) -> %% some checks Now imagine that there are a lot of commands and they are all call is_registered at first. Is there any way to generalize this behavior (refactor this code)? I mean that it's not a good idea to place the same case in all the commands.

    Read the article

  • Combining IN and NOT IN in SQL as single result

    - by UltraVi01
    I apologize for the vague title. I am attempting to write a query that returns an alias column with matching values (resulting from an IN) as well as an alias column with values that do not match (using NOT IN). I want the result set to have: userId | matches | nonmatches. I currently have the following query which returns the matches as expected. I am having trouble getting the nonmatches in the result set -- that is, from a NOT IN statement SET @userId = 9; SELECT ug.user_id, COUNT(DISTINCT goal_id) as matches FROM user_goal ug WHERE ug.user_id!=@userId AND goal_id IN (SELECT iug.goal_id FROM user_goal iug WHERE user_id=@userId) GROUP BY user_id ORDER BY matches DESC LIMIT 4 So, the NOT IN would look something like this: goal_id NOT IN(SELECT uggg.goal_id FROM user_goal uggg WHERE user_id=@userId) AS nonmatches I am just not sure how to incorporate the NOT IN statement in my query so I get all the results

    Read the article

  • asp.net grid view hyper link pass values to new window

    - by srihari
    hai guys here is my question please help me I have a gridview with hyperlink fields here my requirement is if I click on hyperlink of particular row I need to display that particular row values into other page in that page user will edit record values after that if he clicks on update button I need to update that record values and get back to previous home page. if iam clicking hyper link in first window new window should open with out any url tool bar and minimize close buttons like popup modular Ajax ModalPopUpExtender but iam un able to ge that that one please help me the fillowing code is defalut.aspx <head runat="server"> <title>PassGridviewRow values </title> <style type="text/css"> #gvrecords tr.rowHover:hover { background-color:Yellow; font-family:Arial; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView runat="server" ID="gvrecords" AutoGenerateColumns="false" HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White" DataKeyNames="UserId" RowStyle-CssClass="rowHover"> <Columns> <asp:TemplateField HeaderText="Change Password" > <ItemTemplate> <a href ='<%#"UpdateGridviewvalues.aspx?UserId="+DataBinder.Eval(Container.DataItem,"UserId") %>'> <%#Eval("UserName") %> </a> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="FirstName" HeaderText="FirstName" /> <asp:BoundField DataField="LastName" HeaderText="LastName" /> <asp:BoundField DataField="Email" HeaderText="Email" /> </Columns> </asp:GridView> </div> </form> </body> </html> following code default.aspx.cs code using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindGridview(); } } protected void BindGridview() { SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=testdb1"); con.Open(); SqlCommand cmd = new SqlCommand("select * from UserDetails", con); SqlDataAdapter da = new SqlDataAdapter(cmd); cmd.ExecuteNonQuery(); con.Close(); DataSet ds = new DataSet(); da.Fill(ds); gvrecords.DataSource = ds; gvrecords.DataBind(); } } this is updategridviewvalues.aspx <head runat="server"> <title>Update Gridview Row Values</title> <script type="text/javascript"> function Showalert(username) { alert(username + ' details updated successfully.'); if (alert) { window.location = 'Default.aspx'; } } </script> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td colspan="2" align="center"> <b> Edit User Details</b> </td> </tr> <tr> <td> User Name: </td> <td> <asp:Label ID="lblUsername" runat="server"/> </td> </tr> <tr> <td> First Name: </td> <td> <asp:TextBox ID="txtfname" runat="server"></asp:TextBox> </td> </tr> <tr> <td> Last Name: </td> <td> <asp:TextBox ID="txtlname" runat="server"></asp:TextBox> </td> </tr> <tr> <td> Email: </td> <td> <asp:TextBox ID="txtemail" runat="server"></asp:TextBox> </td> </tr> <tr> <td> </td> <td> <asp:Button ID="btnUpdate" runat="server" Text="Update" onclick="btnUpdate_Click" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" onclick="btnCancel_Click"/> </td> </tr> </table> </div> </form> </body> </html> and my updategridviewvalues.aspx.cs code is follows using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class UpdateGridviewvalues : System.Web.UI.Page { SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=testdb1"); private int userid=0; protected void Page_Load(object sender, EventArgs e) { userid = Convert.ToInt32(Request.QueryString["UserId"].ToString()); if(!IsPostBack) { BindControlvalues(); } } private void BindControlvalues() { con.Open(); SqlCommand cmd = new SqlCommand("select * from UserDetails where UserId=" + userid, con); SqlDataAdapter da = new SqlDataAdapter(cmd); cmd.ExecuteNonQuery(); con.Close(); DataSet ds = new DataSet(); da.Fill(ds); lblUsername.Text = ds.Tables[0].Rows[0][1].ToString(); txtfname.Text = ds.Tables[0].Rows[0][2].ToString(); txtlname.Text = ds.Tables[0].Rows[0][3].ToString(); txtemail.Text = ds.Tables[0].Rows[0][4].ToString(); } protected void btnUpdate_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("update UserDetails set FirstName='" + txtfname.Text + "',LastName='" + txtlname.Text + "',Email='" + txtemail.Text + "' where UserId=" + userid, con); SqlDataAdapter da = new SqlDataAdapter(cmd); int result= cmd.ExecuteNonQuery(); con.Close(); if(result==1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:Showalert('"+lblUsername.Text+"')", true); } } protected void btnCancel_Click(object sender, EventArgs e) { Response.Redirect("~/Default.aspx"); } } My requirement is new window should come like pop window as new window with out having url and close button my database tables is ColumnName DataType ------------------------------------------- UserId Int(set identity property=true) UserName varchar(50) FirstName varchar(50) LastName varchar(50) Email Varchar(50)

    Read the article

  • Noob Objective-C/C++ - Linker Problem/Method Signature Problem

    - by Josh
    There is a static class Pipe, defined in C++ header that I'm including. The static method I'm interested in calling (from Objetive-c) is here: static ERC SendUserGet(const UserId &_idUser,const GUID &_idStyle,const ZoneId &_idZone,const char *_pszMsg); I have access to an objetive-c data structure that appears to store a copy of userID, and zoneID -- it looks like: @interface DataBlock : NSObject { GUID userID; GUID zoneID; } Looked up the GUID def, and its a struct with a bunch of overloaded operators for equality. UserId and ZoneId from the first function signature are #typedef GUID Now when I try to call the method, no matter how I cast it (const UserId), (UserId), etc, I get the following linker error: Ld build/Debug/Seeker.app/Contents/MacOS/Seeker normal i386 cd /Users/josh/Development/project/Mac/Seeker setenv MACOSX_DEPLOYMENT_TARGET 10.5 /Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/josh/Development/TS/Mac/Seeker/build/Debug -L/Users/josh/Development/TS/Mac/Seeker/../../../debug -L/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1 -F/Users/josh/Development/TS/Mac/Seeker/build/Debug -filelist /Users/josh/Development/TS/Mac/Seeker/build/Seeker.build/Debug/Seeker.build/Objects-normal/i386/Seeker.LinkFileList -mmacosx-version-min=10.5 -framework Cocoa -framework WebKit -lSAPI -lSPL -o /Users/josh/Development/TS/Mac/Seeker/build/Debug/Seeker.app/Contents/MacOS/Seeker Undefined symbols: "SocPipe::SendUserGet(_GUID const&, _GUID const&, _GUID const&, char const*)", referenced from: -[PeoplePaneController clickGet:] in PeoplePaneController.o ld: symbol(s) not found collect2: ld returned 1 exit status Is this a type/function signature error, or truly some sort of linker error? I have the headers where all these types and static classes are defined #imported -- I tried #include too, just in case, since I'm already stumbling :P Forgive me, I come from a web tech background, so this c-style memory management and immutability stuff is super hazy. Edit: Added full linker error text. Changed "function" to "method" Thanks, Josh

    Read the article

  • Noob Objective-C/C++ - Linker Problem/Function Def Problem

    - by Josh
    There is a static class Pipe, defined in C++ header that I'm including. The function I'm interested in calling (from Objetive-c) is here: static ERC SendUserGet(const UserId &_idUser,const GUID &_idStyle,const ZoneId &_idZone,const char *_pszMsg); I have access to an objetive-c data structure that appears to store a copy of userID, and zoneID -- it looks like: @interface DataBlock : NSObject { GUID userID; GUID zoneID; } Looked up the GUID def, and its a struct with a bunch of overloaded operators for equality. UserId and ZoneId from the first function signature are #typedef GUID Now when I try to call the function, no matter how I cast it (const UserId), (UserId), etc, I get the following linker error: "Pipe::SendUserGet(_GUID const&, _GUID const&, _GUID const&, char const*)", referenced from: -[PeoplePaneController clickGet:] in PeoplePaneController.o Is this a type/function signature error, or truly some sort of linker error? I have the headers where all these types and static classes are defined #imported -- I tried #include too, just in case, since I'm already stumbling :P Forgive me, I come from a web tech background, so this c-style memory management and immutability stuff is super hazy. Thanks, Josh

    Read the article

  • SSRS 2008: is it possible to make a report parameter NOT query-based for some linked report?

    - by Stefan Mohr
    I suspect the answer is no, but here goes.. I'm using the WebForms Report Viewer on a public-facing website to allow users to report on themselves or their users (if the user is an admin user). A report has a parameter called Users where an admin can pick a user from the list and generate a report from it. Mundane users can also view this report, but I programmatically create a linked report for each user and set the UserID value to their ID so they can only view themselves. This works well except that the UserID parameter is query-based, and not every user is visible in the list using default settings (the user list is based off date range parameters can provide, and only users we consider 'active' during the date range are visible). This is blowing up for mundane users that are not active for the default date range (which is the previous month). I suspect the flow of execution is something like this: Report loads with default parameters The linked report rules are now applied and the value of the UserID is overridden with the ID in the linked report UserID field is now hidden to prevent the user from changing it SSRS can't find the UserID default value in the query results (that I didn't even want it to run) so it displays an error The 'UserID' parameter is missing a value Through some testing I've found a perfect correlation between users not inside the default date range and users who can't view the report. Can anyone suggest a way to make the report usable for those users that aren't in the default list? The reports are created programmatically so I do have a fair bit of control over the situation. I would love to simply be able to mark a parameter in a linked report as no longer being query-based, but those properties are all read-only. I really, really don't want to have to create duplicate reports to accommodate these users but I'm at a bit of a loss right now. Any suggestions are greatly appreciated!

    Read the article

  • T-SQL Table Joins - Unique Situation

    - by Dimitri
    Hello Everyone. This is my first time encountering the case like this and don't quite know how to handle. Situation: I have one table tblSettingsDefinition, with fields: ID, GroupID, Name, typeID, DefaultValue. Then I have tblSettingtypes with fields TypeID, Name. And I have final table, tblUserSettings with fields SettingID, SettingDefinitionID, UserID, Value. The whole point of this is to have customizable settings. Setting can be defined for a Group or as global setting (if GroupID is NULL). It will have a default value, but if user modifies the setting, an entry is added to tblUserSettings that stores new value. I want to have a query that grabs user settings by first looking at the tblUserSettings, and if it has records for the given user, grabs them, if not retrieves default settings. But the trick is that no matter if user has settings or not, I need to have fields from other two table retrieved to know the setting's Type, Name etc... (which are stored in those other tables). I'm writing query something like this: SELECT * FROM tblSettingDefinition SD LEFT JOIN tblUserSettings US ON SD.SettingID = US.SettingDefinitionID JOIN tblSettingTypes ST ON SD.TypeID=ST.ID WHERE US.UserID=@UserID OR ((SD.GroupID IS NULL) OR (SD.GroupID=(SELECT GroupID FROM tblUser WHERE ID=@UserID))) but it retrieves settings for all users from tblUserSettings instead of just ones that match current @UserID. And if @UserID has no records in tblUserSettings, still, all user settings are retrieved instead of the defaults from tblSettingDefinition. Hope I made myself clear. Any help would be highly appreciated. Thank you.

    Read the article

  • NHibernate2 query is wired when fetch the collection from the proxy. Is this correct behavior?

    - by ensecoz
    This is my class: public class User { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IList<UserFriend> Friends { get; protected set; } } public class UserFriend { public virtual int Id { get; set; } public virtual User User { get; set; } public virtual User Friend { get; set; } } This is my mapping (Fluent NHibernate): public class UserMap : ClassMap<User> { public UserMap() { Id(x => x.Id, "UserId").GeneratedBy.Identity(); HasMany<UserFriend>(x => x.Friends); } } public class UserFriendMap : ClassMap<UserFriend> { public UserFriendMap() { Id(x => x.Id, "UserFriendId").GeneratedBy.Identity(); References<User>(x => x.User).TheColumnNameIs("UserId").CanNotBeNull(); References<User>(x => x.Friend).TheColumnNameIs("FriendId").CanNotBeNull(); } } The problem is when I execute this code: User user = repository.Load(1); User friend = repository.Load(2); UserFriend userFriend = new UserFriend(); userFriend.User = user; userFriend.Friend = friend; friendRepository.Save(userFriend); var friends = user.Friends; At the last line, NHibernate generate this query for me: SELECT friends0_.UserId as UserId1_, friends0_.UserFriendId as UserFrie1_1_, friends0_.UserFriendId as UserFrie1_6_0_, friends0_.FriendId as FriendId6_0_, friends0_.UserId as UserId6_0_ FROM "UserFriend" friends0_ WHERE friends0_.UserId=@p0; @p0 = '1' QUESTION: Why the query look very wired? It should select only 3 fields (which are UserFriendId, UserId, FriendId) Am I right? or there is something going on inside NHibernate?

    Read the article

  • Passing filtering functions to Where() in LINQ-to-SQL

    - by Daniel
    I'm trying to write a set of filtering functions that can be chained together to progressively filter a data set. What's tricky about this is that I want to be able to define the filters in a different context from that in which they'll be used. I've gotten as far as being able to pass a very basic function to the Where() clause in a LINQ statement: filters file: Func<item, bool> returnTrue = (i) => true; repository file: public IQueryable<item> getItems() { return DataContext.Items.Where(returnTrue); } This works. However, as soon as I try to use more complicated logic, the trouble begins: filters file: Func<item, bool> isAssignedToUser = (i) => i.assignedUserId == userId; repository file: public IQueryable<item> getItemsAssignedToUser(int userId) { return DataContext.Items.Where(isAssignedToUser); } This won't even build because userId isn't in the same scope as isAssignedToUser(). I've also tried declaring a function that takes the userId as a parameter: Func<item, int, bool> isAssignedToUser = (i, userId) => i.assignedUserId == userId; The problem with this is that it doesn't fit the function signature that Where() is expecting: Func<item, bool> There must be a way to do this, but I'm at a loss for how. I don't feel like I'm explaining this very well, but hopefully you get the gist. Thanks, Daniel

    Read the article

  • Avoid MySQL multi-results from SP with Execute

    - by hhyhbpen
    Hi, i have an SP like BEGIN DECLARE ... CREATE TEMPORARY TABLE tmptbl_found (...); PREPARE find FROM" INSERT INTO tmptbl_found (SELECT userid FROM ( SELECT userid FROM Soul WHERE .?.?. ORDER BY .?.?. ) AS left_tbl LEFT JOIN Contact ON userid = Contact.userid WHERE Contact.userid IS NULL LIMIT ?) "; DECLARE iter CURSOR FOR SELECT userid, ... FROM Soul ...; ... l:LOOP FETCH iter INTO u_id, ...; ... EXECUTE find USING ...,. . .,u_id,...; ... END LOOP; ... END// and it gives multi-results. Besides it's inconvenient, if i get all this multi-results (which i really don't need at all), about 5 (limit's param) for each of the hundreds of thousands of records in Soul, i'm afraid it will take all my memory (and all in vain). Also, i noticed, if i do prepare from an empty string, it still has multi-results... At least how to get rid of them in the execute statement? And i would like to have a recipe to avoid ANY output from SP, for any possible statement (i also have a lot of "update ..."s and "select ... into "s inside, if they can produce multi's). Tnx for any help...

    Read the article

  • Special characters stripped by mySQL/PHP JSON

    - by Will Gill
    Hi, I have a simple PHP script to extract data from a mySQL database and encode it as JSON. The problem is that special characters (for example German ä or ß characters) are stripped from the JSON response. Everything after the first special character for any single field is just stripped. The fields are set to utf8_bin, and in phpMyAdmin the characters display correctly. The PHP script looks like this: <?php header("Content-type: application/json; charset=utf-8"); $con = mysql_connect('database', 'username', 'password'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sql01_5789willgil", $con); $sql="SELECT * FROM weightevent"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $events = array(); while($row = mysql_fetch_array($result)) { $eventid = $row['eventid']; $userid = $row['userid']; $weight = $row['weight']; $sins = $row['sins']; $gooddeeds = $row['gooddeeds']; $date = $row['date']; $event = array("eventid"=>$eventid, "userid"=>$userid, "weight"=>$weight, "sins"=>$sins, "gooddeeds"=>$gooddeeds, "date"=>$date); array_push($events, $event); } $myJSON = json_encode($events); echo $myJSON; mysql_close($con); ?> Sample output: [{"eventid":"2","userid":"1","weight":"70.1","sins":"Weihnachtspl","gooddeeds":"situps! lots and lots of situps!","date":"2011-01-02"},{"eventid":"3","userid":"2","weight":"69.9","sins":"A second helping of pasta...","gooddeeds":"I ate lots of salad","date":"2011-01-01"}] -- in the first record the value for field 'sins' should be "Weihnachtsplätzchen". thanks very much!

    Read the article

  • LINQ-to-SQL - Join, Count

    - by ile
    I have following query: var result = ( from role in db.Roles join user in db.Users on role.RoleID equals user.RoleID where user.CreatedByUserID == userID orderby user.FirstName ascending select new UserViewModel { UserID = user.UserID, PhotoID = user.PhotoID.ToString(), FirstName = user.FirstName, LastName = user.LastName, FullName = user.FirstName + " " + user.LastName, Email = user.Email, PhoneNumber = user.Phone, AccessLevel = role.Name }); Now, I need to modify this query... Other table I have is table Deals. I would like to count how many deals user created last month and last year. I tried something like this: var result = ( from role in db.Roles join user in db.Users on role.RoleID equals user.RoleID //join dealsYear in db.Deals on date.Year equals dealsYear.DateCreated.Year join dealsYear in ( from deal in db.Deals group deal by deal.DateCreated into d select new { DateCreated = d.Key, dealsCount = d.Count() } ) on date.Year equals dealsYear.DateCreated.Year into dYear join dealsMonth in ( from deal in db.Deals group deal by deal.DateCreated into d select new { DateCreated = d.Key, dealsCount = d.Count() } ) on date.Month equals dealsMonth.DateCreated.Month into dMonth where user.CreatedByUserID == userID orderby user.FirstName ascending select new UserViewModel { UserID = user.UserID, PhotoID = user.PhotoID.ToString(), FirstName = user.FirstName, LastName = user.LastName, FullName = user.FirstName + " " + user.LastName, Email = user.Email, PhoneNumber = user.Phone, AccessLevel = role.Name, DealsThisYear = dYear, DealsThisMonth = dMonth }); but here is even syntax not correct. Any idea? Btw, is there any good book of LINQ to SQL with examples?

    Read the article

  • How to write a JOIN statement to combine data from disparate tables

    - by Amarundo
    I have the following 2 procedures that I use as my source for a report. As of now, I'm presenting 2 different tables in my SQL Server Reporting Services 2008 R2 report, because it doesn't let me put them together as they belong to 2 different data sets. I want to present them in a single table, but I have not been successful trying to use JOIN here. How do I do that? NOTE: cName in IAgentQueueStats corresponds to UserId in AgentActivityLog. /*** Aggregate values for Call Center Agents for calls, talk and hold time ***/ /*** The detail/row values is per 30-minute interval ***/ ALTER PROCEDURE [dbo].[sp_IAgentQueueStats_OnlyCalls_Grouped] @p_StartDate datetime, @p_EndDate datetime, @p_Agents varchar(8000) AS SELECT [cName] ,sum([nAnswered]) SumNAnswered ,sum([nAnsweredAcd]) SumNAnsweredAcd ,sum([tTalkAcd]) SumTTalkAcd ,sum([nHoldAcd]) SumNHoldAcd ,sum([tHoldAcd]) SumTHoldAcd ,sum([tAcw]) SumTAcw FROM [I3_IC].[dbo].[IAgentQueueStats] WHERE dIntervalStart between @p_StartDate and DATEADD(s, 86400-1, @p_EndDate) AND CHARINDEX ( cName ,@p_Agents)> 0 AND cReportGroup <> '*' AND cHKey3 = '*' and cHKey4 ='*' AND nEnteredAcd > 0 AND cReportGroup <> 'CCFax Email' GROUP BY cName And here is the second one: /*** Aggregate values for Call Center Agents for status/activity time ***/ /*** The detail/row values is per start-time/end-time ***/ ALTER PROCEDURE [dbo].[sp_AgentActivity_Grouped] @p_StartDate datetime, @p_EndDate datetime, @p_Agents varchar(8000) AS SELECT [UserId],[StatusCategory],SUM([StateDuration]) [StatusDuration] FROM ( SELECT [UserId] ,[StatusGroup] ,[StatusKey] , CASE [StatusKey] WHEN 'Available' THEN 'Productive' WHEN 'Follow Up' THEN 'Productive' WHEN 'Campaign Call' THEN 'Productive' WHEN 'Awaiting Callback' THEN 'Productive' WHEN 'In a Meeting' THEN 'Not Your Fault' WHEN 'Project Work' THEN 'Not Your Fault' WHEN 'At a Training Session'THEN 'Not Your Fault' WHEN 'System Issues' THEN 'Not Your Fault' WHEN 'Test' THEN 'Not Your Fault' WHEN 'At Lunch' THEN 'Non Productive' WHEN 'Available, Forward' THEN 'Non Productive' WHEN 'Available, Follow-Me' THEN 'Non Productive' WHEN 'At Play' THEN 'Non Productive' WHEN 'AcdAgentNotAnswering' THEN 'Non Productive' WHEN 'Do Not Disturb' THEN 'Non Productive' WHEN 'Available, No ACD' THEN 'Non Productive' WHEN 'Away from desk' THEN 'Non Productive' ELSE [StatusKey] END StatusCategory ,stateduration FROM [I3_IC].[dbo].[AgentActivityLog] WHERE [StatusDateTime] between @p_StartDate and DATEADD(s, 86400-1, @p_EndDate) AND CHARINDEX ( [UserId] ,@p_Agents)> 0 AND [StatusKey] not in ('Gone Home','Out of the Office','On Vacation','Out of Town') ) a GROUP BY [UserId],[StatusCategory] ORDER BY [UserId], [StatusCategory] desc BTW, if I take some time to comment/reply on your posts, it's not lack of interest, but of understanding...

    Read the article

  • Problem FlashVars parameter asp.net

    - by sofie-vo
    Code for asp.net page <%@ Page Language="VB" AutoEventWireup="false" CodeFile="trainingupload.aspx.vb" Inherits="trainingupload" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div height> <object width="1000" height="800"> <param name="movie" value="player.swf" /> <param name="FlashVars" value='userid=<%=String.Format(getuser())%>" '/> <embed src="bin-release/trainingscentrum.swf" FlashVars='userid=<%=String.Format(getuser())%>" ' width="1500" height="800" /> </embed> </object> </div> </form> </body> </html> Code behind Public Function getuser() As Guid Dim user As MembershipUser = Membership.GetUser() Dim userid As Guid = (CType(user.ProviderUserKey, Guid)) Return userid End Function In the code above I use an function to return the userid. When I replace <%=String.Format(getuser())% with an actual userid, I get the value in my flex application. But this code returns nothing. What am I doing wrong?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >