Linq-to-SQL And ASP:Repeater

May 25, 2008

Hi there,

In 2005.NET, if I used an asp:repeater, I would load the data from source and then manipulate it like so://load the data from source using a predefined connection and SQL Statement.private void LoadMyDataFromSource(){        try
        {
            connection.Open();
            OleDbDataReader myReader = comm.ExecuteReader();                        rptrCatList.DataSource = myReader;
            rptrCatList.DataBind();             myReader.Close();   
        }        finally
        {
            connection.Close();
        }} //catch the ItemDataBound event and manipulate the data how I wish before it's loaded into the Repeater.protected void rptrCatList_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            int title = 4; //this is the index of the column I wish to manipulate((Label)e.Item.FindControl("lblTitle")).Text = ((IDataRecord)e.Item.DataItem).GetString(title) + ":"       }   }This would give me all the flexbility I ever needed. But now I wish to use linq and since the IDataRecord relies on dataReader sources, I cannot obtain the same flexbility. Can anyone point me in the right direction for obtaining the same kind of flexbility but using a linq-to-SQL dataContext? I wish to manipulate mostData that comes through from my source, so: //loadng the data in via my linq-to-sql context.private void LoadProducts()
    {
        MyDataContext db = new MyDataContext ();        var all = from p in db.Products_IncontinenceStandards
                  where p.Product_Cat == "Category1"
                  select p;        rpterCat.DataSource = all;
        rpterCat.DataBind();
    }This is where I get stuck because, even though I can still capture the ItemDataBound event since I have databound the Repeater to the linqSource, I can't access the individual fields (or this is what I think I can't do!), Does anyone know how to relate to this so I can create the same effect? Many Thanks,Nathan Channon

 

View 4 Replies


ADVERTISEMENT

Problem With Repeater

Sep 21, 2006

I'm new to ASP.NET and i've been banging my head aganist this problem for a few days now.I have a repeater and then a repeater inside that repeater. <asp:SqlDataSource ID="sqlRepeater1" runat="server" ConnectionString="<%$ ConnectionStrings:Inspections_DBCS %>" SelectCommand="SELECT count(*) as mycount FROM insuranceco with (NOLOCK) where insurancecoid=@insurancecoid" OnSelecting="sqlRepeater_Selecting" > <SelectParameters> <asp:Parameter DefaultValue='' Name="insurancecoid" Type="String" /> </SelectParameters> </asp:SqlDataSource> <% 'sqlRepeater1.SelectParameters["insurancecoid"].DefaultValue = "123"; %>This returns:Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30451: Name 'sqlRepeater1' is not declared.Source Error:Line 38: Line 39: <% Line 40: sqlRepeater1.SelectParameters["insurancecoid"].DefaultValue = "123";Line 41: %>Line 42: I tried a solution i saw on the web about using the onselecting event but that didn't pan out either Protected Sub sqlRepeater_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) 'Handles sqlRepeater1.Selecting WithEvents 'Response.Write(e.Command.Parameters.Add) 'e.Command.Parameters.Add(e.Command.CreateParameter("P1", "test")) 'e.Command.Parameters.Add("P1", "value")I have to be doing something wrong because i would think there has to be a way to reference variables when you are going from repeater to repeater i just dont know.Please help my mask of sanity is starting to slip off.Thanks

View 4 Replies View Related

How To Take Single Value From Sql Query For Repeater ?

Oct 29, 2006

So I have code to fill my repeater with a data: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        Dim cnn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("db_ConnStr").ConnectionString)        Dim cmd1 As Data.SqlClient.SqlDataAdapter = New Data.SqlClient.SqlDataAdapter("SELECT aspnet_Users.UserName, COUNT(forum_posts.post_id) AS IlePost, forum_posts_1.post_content, forum_posts_1.topic_id, forum_posts_1.post_id, forum_posts_1.post_date FROM aspnet_Users INNER JOIN forum_posts ON aspnet_Users.uID = forum_posts.user_id INNER JOIN forum_posts AS forum_posts_1 ON aspnet_Users.uID = forum_posts_1.user_id GROUP BY aspnet_Users.UserName, forum_posts_1.post_content, forum_posts_1.topic_id, forum_posts_1.post_id, forum_posts_1.post_date HAVING (forum_posts_1.topic_id = @topic_id) ORDER BY forum_posts_1.post_date ASC", cnn)        cmd1.SelectCommand.Parameters.AddWithValue("@topic_id", Request.QueryString("ID"))        Dim ds As Data.DataSet = New Data.DataSet        cnn.Open()        cmd1.Fill(ds, "posts")        Repeater1.DataSource = ds.Tables("posts")        Page.DataBind()        cnn.Close()    End Sub And I want to take the value from column which I bolded - IlePost. I want take this out at compare with some condition. For example:Dim label as label = Repeater1.Findcontrol("Label1")If COLUMN < 10 thenlabel.text = "Less than 10"elselabel.text = "More than 10"I hope you understand me :-) 

View 1 Replies View Related

Nested Repeater Query

Mar 11, 2007

Hello Everyone,I am trying to create a query for the purpose of a nested repeater relation. The information needs to be pulled from one table. I have shortened the columns to the ones that are required.table - PagesIDPageNameParentPageIDSo, take the following example:ID 14, PageName - Service A, ParentPage ID = 6ID 15, PageName - Service B, ParentPage ID = 6ID 36 PageName - Client 1, ParentPage ID = 14ID 37 PageName - Client 2, ParentPage ID = 14ID 38 PageName - Client 3, ParentPage ID = 15ID 39 PageName - Client 4, ParentPage ID = 15 So, I want to create a query that will get my nested repeater to display as follows:Service A    Client 1    Client 2Service B    Client 3    Client 4What I have come up with so far is:SELECT * from tbl_Pages WHERE ParentPageID IN  (Select ID From tbl_Pages)SELECT p.ParentPageID, p.PageName, p.ID FROM tbl_Pages pThe relation would be based off ParentPageID. I keep getting errors that either there is no unique value or the relation is null. What am I am missing here? 

View 5 Replies View Related

Identifying The Servercontrol In Repeater

Jun 15, 2007

Hell Sir,
   I am using  repeater control to show the result after search .and using checkbox control in itemtemplate row .After searchresult i am facing a problem in identifying the checked checkboxes in the itemtemplate of repeater control .
Please provide appropriate solution ....
                                                    thanks for ur attention...

View 3 Replies View Related

Basic SQL Question And ASP.net Repeater

May 14, 2008

Hi,

I'm coming from a language called Progress and need some basic help with SQL and ASP.net

Here's my item table from database with 6 recordscolor fruit

red applered bananared cherryblue appleblue bananablue cherry

My goal is to put in HTML tables like so..



red





apple
banana
cherry









blue





apple
banana
cherry

I was going to use the ASP.net Repeater control by doing with some SQL statement that will produce this 6 records with a calculated field..
color fruit firstColorInFruitGroupred apple yesred banana nored cherry noblue apple yesblue banana noblue cherry no
So basically when I see a yes thats when I know its a <TH>"heading" 
When I see a no, thats when I see that its a <TD> "data" 
How would I write this SQL statement? or is there a better way of doing this? Thanks much! 
  

View 7 Replies View Related

Repeater - Multiple Datasources?

Jun 4, 2008

I need to set a Repeater.Datasource to one of three stored procedures depending on what button the user selects.  How do I set it up please?<asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ABCConnectionString %>"SelectCommand="???????????????" SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameter ControlID="???????????????????" Name="?????????????" PropertyName="Text" Type="string" /></SelectParameters></asp:SqlDataSource>
 protected void btnKeyWordSearch_Click(object sender, ImageClickEventArgs e){    mode = 1;    StoredProcdureName = "KWSearch";    KWords = tbxKWordText.Text;}protected void btnCompanyNameSearch_Click(object sender, ImageClickEventArgs e){     mode = 1;    StoredProcdureName = "NAMESearch";    CoName = tbxCoNameText.Text;}protected void btnBrandNameSearch_Click(object sender, ImageClickEventArgs e){    mode = 1;    StoredProcdureName = "BRANDSearch";    Brand = tbxBrandText.Text;}

View 1 Replies View Related

Need SQL To Perform Repeater Paging

Feb 15, 2005

I want to build some paging functionality into my repeater (b4 you ask, datagrid not providing flexibility required for presentation).

I will have no problem with the VB logic but I will need to execute SQL that only returns results from x to y (e.g. results 21 thru 40 for page 2). I know I can do something like 'SELECT TOP 20 * FROM...', or something like it, for page 1. But, I'm not sure if it's possible to build SQL for the pages greater than 1. Any suggestions.

Thanks
Martin

View 1 Replies View Related

Repeater And Stored PRocedure

Aug 29, 2005

Q1 - I want to compare file names uploaded by users with the name of the file present in the database. I have a repeated control that shows the data alongwith an array of <input type=file> that is createddynamically when the data is displayed in the repeater control. (So there is an input tag within the ItemTEmplate tag in the repeater)Now I want to compare the names of the files uploaded by the user with the values as displayed in the repeater. Is there a way I can do this? So I need to be able to get the data (for example Name) as displayed in the repeater control into a variable like Dim strName As String. Something like: Dim strName As String = (value from the repeater control) Can I do this? How?
Q2 - I want to return a value from a stored procedure that will be stored in a variable in VB and will be used for comparison. So, I want to return a 0 or 1 and then use .ReturnValue method to store this value. The problem that I am facing is that I am using a cursor. And as soon as return is called in the SP it exitsthe procedure and returns only one value (1 if found 0 otherwise) So it does not loop through the completecursor. What can I do to fix this? CODE:
OPEN cur1--print 'Cursor Open'FETCH NEXT FROM cur1 INTO @varFile, @varFileEx, @varFileSt
WHILE @@FETCH_STATUS = 0BEGINIF (@varFile = @FileName AND @varFileEx = @FileExt)BEGINset  @varReturn = 0ENDELSE BEGINset @varReturn = 1ENDFETCH NEXT FROM cur_FileSystem INTO @varFileName, @varFileExt, @varFileStatusreturn (@varReturn)ENDCLOSE cur_FileSystemDEALLOCATE cur_FileSystem
Please help. Thanks

View 2 Replies View Related

Help With UPDATE With SqlDataSource And A Repeater

Jan 15, 2006

Hi,
I have a repeater which i need to build editing capabilities into in a similar way as the GridView, just a little unsure how to tie it together.  Ideally i would like to use a GridView as this would do all of the work for me however it looks like I need to go with the repeater due to the nested nature of the data I am working with.
What is the best way to go about updating the data source from within a repeater?  I have already built the edit interface with some MultiViews in the Repeater control and handling the ItemCommand event, just not sure how to actually update the data source.
Can I still use the SqlDataSource wizard to generate all of the SQL for me?  If so, within the ItemCommand event handler I have the data i want to update back to the database by using the FindControl method and retrieving the Text, but how do i get this data into the SqlDataSource object and update the database?
Are there any samples available which show how to update a datasource using a repeater?
Your help is much appreciated
trenyboy

View 6 Replies View Related

Whats Wrong With Following Repeater And Sqldatasource?

Dec 6, 2006

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.  
 original source code
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" SelectCommand="SELECT [authorID], [firstname] FROM [author] where id=1" ></asp:SqlDataSource>
<asp:Repeater ID="rpt" DataSourceID="SqlDataSource1" runat="server">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 100; left: 65px; position: absolute;
top: 59px" Text='<%# authorID %>' ></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Style="z-index: 101; left: 66px; position: absolute;
top: 96px" Text='<%# firstName %>'></asp:TextBox>
</ItemTemplate>
</asp:Repeater>
 
<asp:Button ID="Button1" runat="server" Style="z-index: 102; left: 46px; position: absolute;
top: 164px" Text="next" />
<asp:Button ID="Button2" runat="server" Style="z-index: 103; left: 102px; position: absolute;
top: 163px" Text="first" />
<asp:Button ID="Button3" runat="server" Style="z-index: 104; left: 156px; position: absolute;
top: 162px" Text="prev" />
<asp:Button ID="Button4" runat="server" Style="z-index: 106; left: 208px; position: absolute;
top: 162px" Text="last" />
 
</div>
</form>
Compiler Error Message: CS0103: The name 'authorID' does not exist in the current contextSource Error:





Line 13: <asp:Repeater ID="rpt" DataSourceID="SqlDataSource1" runat="server">
Line 14: <ItemTemplate>
Line 15: <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 100; left: 65px; position: absolute;
Line 16: top: 59px" Text='<%# authorID %>' ></asp:TextBox>
Line 17: <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 101; left: 66px; position: absolute;

View 1 Replies View Related

Check For Null In Repeater Date Field

Jan 27, 2008

I'm about ready to pull my hair out.  I have a repeater control, and a date field.  If the field is a valid date, I'll use it to calculate and display the person's age.  Otherwise, I want to display "N/A".  My problem is trying to determine if the date field is null or not.I'm using SQL Server 2005 which allows Nulls in the date field, and for many records I don't have a birth date.  It makes sense for these records to leave the date Null.  This is my code:Protected Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound    If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then        Dim LabelIcon As Label = CType(e.Item.FindControl("LabelIcon"), Label)        Dim LblAge As Label = CType(e.Item.FindControl("LblAge"), Label)        Dim inmate As WAP.prisonmembersRow = CType(CType(e.Item.DataItem, System.Data.DataRowView).Row, WAP.prisonmembersRow)        If System.IO.File.Exists(Server.MapPath("~/images/picts/" & inmate.FILE2 & ".jpg")) Then            LabelIcon.Visible = True        End If        If inmate.DATE_OF_BIRTH Is DBNull.Value Then            If IsDate(inmate.DATE_OF_BIRTH) Then                LblAge.Text = "Age: N/A"            Else                LblAge.Text = "Age: " & GetBirthdate(inmate.DATE_OF_BIRTH)            End If        End If    End IfEnd Sub How can I resolve this?Diane 

View 7 Replies View Related

Using Date Field In Search String To Bind To Repeater

Apr 5, 2004

i am trying to search an SQL database to retrieve all names from employee table who have a birthday today. this needs to automatically fill in the date parameter with the system date. this is what i have so far:


sub page_load(sender as object, e as eventargs)
dtmDate=DateTime.Now.ToString("M")
con = New SqlConnection("Server=Localhost;UID=******;PWD=*****;Database=Pubs")

cmd = New SqlCommand("Select fname, lname From Employee where dob='& dtmDate'", con)

con.open()
dtrBday = cmd.ExecuteReader()

rptBday.DataSource=dtrBday
rptBday.DataBind()
dtrBday.Close()



I know this isnt quite right. i get errors when it hits my repeater.

the error i am getting is :Syntax error converting string to smalldatetime data type.
if someone could give me a push in the right direction here it would be greatly appreciated.

View 2 Replies View Related

Max With LINQ

Jan 8, 2008

Hello!
I try to get a list of ConditionsVersion where Version is MAX for each ConditionsVersion.
I tried something like this (as seen on http://msdn2.microsoft.com/en-us/vcsharp/aa336747.aspx#maxGrouped):
 
1 List<ConditionsVersion> list = (from cv in ConditionsVersions2 group cv by cv.FKConditions into cv3 select new { 4 PKConditions = cv.PKConditions,5 FKConditions = cv.FKConditions,6 MaxVersion = cv.GroupBy.Max(cv => cv.Version)7 CTimestamp = cv.Timestamp8 }).ToList(); 

But it doesn't work. It would be great if someone knows why.
Thank you!   

View 2 Replies View Related

LINQ - What Do You THINK?

Nov 2, 2007

Well, just played a little bit with that new thing from Microsoft. Genius! Microsoft presented that step backwards as a step forward.

Say good bye to the 3-tier architecture, now any programmer, after 1 week training, will be able to put SELECT * into the source code. No more stored procedures and logic on a server. No more ugly WHERE clauses. Just SELECT * and pass all records in a loop :)

When I looked at the queries, generated by LINQ in SQL profiler, I noticed that they are generated automatically using the same pattern. It is obvious, of course, but now it would be really difficult to trace a problematic query back to the C# code. All updates to table X will look like as identical twins!

On the other side, it is not so bad. We will have soon a lot of projects, failing when they go to the production and face the real volumes of data. And a long queue of companies, crying and asking to save them. Perfect “job security�. Please, use LINQ! Port all your code to LINQ immediately (Laughing demonically like Dr. Evil)

Hm… a second thought, but what could we suggest to these companies, having performance problems with LINQ 3rd party applications, when there is no source code? Now we could at least modify some stored procedures, and with LINQ looks like the only recommendation could be “contact a developer of that application or buy more a powerful server�.

View 18 Replies View Related

LINQ To SQL

Apr 20, 2008

Is it possible to use LINQ to SQL with Report Services? If so, are there any examples, tutorials, etc.?

View 1 Replies View Related

Linq To Sql

May 28, 2008

Is Linq a feature of sql server 2008 ?
Or is it a feature of DOt net. Visual Studio 2008 ?

View 1 Replies View Related

Linq To Sql

May 28, 2008

Some say linq to sql leads to the death of stored procedures is it correct ?

View 4 Replies View Related

Linq + Sql Server Everywhere = ?

Nov 8, 2006

Will Linq be compatible with Sql Server Everywhere without having to add additional plugins?

View 7 Replies View Related

LINQ To SQL Question ?

Dec 30, 2007

Hullo am using Asp.Net 3.5, I want to create a usercontrol that is supported to all projects to upload file into sqlserver,
the user just give the database connection string,
tablename, column name depending upon their need, here I develop the
code using LINQ technology.
I Write a class with simple format like below,
 
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Linq;
 
/// <summary>
/// Summary description for FILE_MASTER_INSERT
/// </summary>
//namespace Linq2Sql_demo_doc
//{
   
    [System.Data.Linq.Mapping.Table(Name = "FILE_MASTER")]
 
    public partial class FILE_MASTER
    {
 
    string Tablename;
        public FILE_MASTER()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        [System.Data.Linq.Mapping.Column(Name="filename")]
        public string FileName
        {
            get;
 
            set;
 
           
        }
 
        [System.Data.Linq.Mapping.Column(Name = "file_content")]
        public byte[] file_content
        {
            get;
 
            set;
 
 
        }
 
        [System.Data.Linq.Mapping.Column(Name = "file_id", IsPrimaryKey = true, IsDbGenerated = true, CanBeNull = false)]
       
        public int file_id
        {
            get;
            set;
 
        }
 
    }
 
    public class TestDB : DataContext
    {
 
        public Table<FILE_MASTER> FILE_MASTERs;
 
       //Initializing base class constructor
 
        public TestDB(string s) : base(s) { }
               
    }
 
 This
is working but, this is suitable only for single table, I expect
depending upon the user input automaticaly the tablename, column name
will change in the yellow block codes  .
Is there any way to update the tablename , columnname from any other class?
 
 
                  Thank you. Jeyaseelan  

View 1 Replies View Related

When IDENTITY_INSERT Is Set To OFF. -- LINQ

Jan 21, 2008

I'm new to ASP/VS/Linq and I'm having a small problem.
 I have one table setup in SQL Server Express 2005 through Visual Studio 2008.  The table name is "Users" and has three columns (accountID, userName, email).  AccountID is the primary key and set to auto incriment.  I've added a couple of records by hand and it works.
I have a single form with a button, a label, and two text boxes.  The button code is below.  After entering some fake data that does not already exist in the database and clicking the button I get this.
Cannot insert explicit value for identity column in table 'Users' when IDENTITY_INSERT is set to OFF.
I understand that it is trying to insert something into the accountID field but I don't understand why since I'm only providing a username and e-mail address to insert.
Your help is greatly appreciated.protected void Button1_Click(object sender, EventArgs e)
{
MyDatabaseDataContext db = new MyDatabaseDataContext();
var query = from u in db.Users
where u.email == txtEmail.Text
select u;

var count = query.Count();
if (count == 0)
{
//Create a new user object.
User newUser = new User();

newUser.username = txtUsername.Text;
newUser.email = txtEmail.Text;

//Add the user to the User table.
db.Users.InsertOnSubmit(newUser);
db.SubmitChanges();
}
else
{
Label1.Text = txtEmail.Text + " already exists in the database.";

 

View 6 Replies View Related

Linq ISingleResult

Jan 27, 2008

I have a supplier table with all my suppliers in it. I list them in a gridview. In this gridview, there is a link next to each record to an edit page. Below is the code for the edit page.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim db As New orderLinqDataContext

Dim q = db.selectSupplierByID(Request.QueryString("id"))
Dim r As New System.Data.DataTable


txtFriend.Text = q(0).friendlyName
txtAdd1.Text = q(0).address1
txtAdd2.Text = q(0).address2
txtAdd3.Text = q(0).address3
txtAdd4.Text = q(0).address4
txtName.Text = q(0).supplierName
txtPhone.Text = q(0).phone
txtFax.Text = q(0).fax
txtPostCode.Text = q(0).postCode
End Sub
 This causes a runtime error. The error is: "The query results cannot be enumerated more than once." and the txtAdd1.text line is highlighted.
How am I supposed to get at the data so I can fill my text boxes this way?
Thanks,

View 5 Replies View Related

How To Do Where In Select In Linq?

Mar 7, 2008

var query =    from cloc in context.t_companylocs    where (cloc.ref_company == companyid) && (cloc.street == attributes["Street"])        && (cloc.postalcode == attributes["Postalcode"]) && (cloc.country in countrylist)        && (cloc.city in citylist)    select cloc; attributes is a Dictionary<string, string> object.countrylist and citylist are List<string> objects.Of course the syntax above doesn't work. It's basically what I'm trying to achieve :-)A quick and dirty solution would be to just drop the two where constraints containing the "where in" statement and handle that part in the following foreach() loop.Can anyone please explain how you would do it properly?regards 

View 1 Replies View Related

Linq To Sql -- Inserting

Mar 12, 2008

Does anyone have a good example of how to insert data using System.Data.Linq?  All the examples I've seen do something likeNorthwindDataContext db = new NorthwindDataContext();var x = new Product() {...}; db.Products.Add(x);db.SubmitChanges(); However I'm not seeing an Add method on System.Data.Linq.Table<T>.  Has this changed?  Could I somehow not be generating my model correctly?

View 2 Replies View Related

Linq To Sql Autogenerated Value

Mar 20, 2008

Hello,
How can I get autogenerated value of inserted item with linq to sql?
Thanks

View 2 Replies View Related

LINQ To SQL Using CONTAINS Or CONTAINSTABLE Possible?

May 12, 2008

I would like to use LINQ to generate a sql statement that does not use LIKE, but rather uses CONTAINS.  Is this possible?  If not, my second question is whether or not I can parameterize a SqlCommand that uses CONTAINS.  For example the following statement works just fine when I pass in the parameter via SqlCommand.Parameters.AddWithValue()SELECT * FROM [event] WHERE CONTAINS(comments, @searchTerm1)However, the following results in a variable not defined error.SELECT * FROM [event] WHERE (comments LIKE @searchTerm1)Any ideas?  Thanks for your help. 

View 1 Replies View Related

SSIS Or LINQ

Apr 24, 2008

Hi,
I am beginner in SQL Server So excuse me if my question is stange for you.

I have to work on an sql server 2005. I need to extract data from this server in XML file. I have look at a lots of thing and I find two solutions:

- Use SSIS
- Create a home made solution with LINQ in c#

Clearly I do not have enouth experience to see with solution are the most available? Which are the things required to use those solutions?

Thanks

View 12 Replies View Related

Left Join Using Vb 9.0 And LINQ

Dec 2, 2007

Hi Guys,
I started working with linq and vb9.0 but i have a small problem i could feagure how to solve in c# but not in vb
I wanted to make left join or right join on vb 9.0 and linq is it possible or this is only c# feature ?
Waiting to hear from u guys,
Thanks
Softy

View 2 Replies View Related

Add Multimple Data Using LINQ

Dec 30, 2007

 Hello,          How do I add multiple data using LINQ, this one doesn't work. ...    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim i As Integer        For i = 0 To 3            Dim db As personalDataContext = New personalDataContext            Dim p As personal = New personal            p.name = "John"            p.number = "01213"            p.picture = "image/image.jpg"            db.personals.InsertOnSubmit(p)        Next    End Sub... cheers,imperialx 

View 1 Replies View Related

Multiple Where Predicates In Linq?

Jan 7, 2008

I'm just starting to dabble around with LINQ and all of the examples I've come across all have 1 where clause. Is this intentional such that we are supposed to build queries on top of queries or is there a method in which I can add multiple predicates to my 1 query? I'm sorry if this sounds like a stupid question, I've been googling it to death and reading the few manuals on LINQ but like I said, all of the examples have had 1 where predicate.
 
 
Thanks,
Chance 
 

View 2 Replies View Related

Annoying Problem With LINQ To SQL

May 3, 2008

hi, i'm working with LINQ to SQL and i have a table called Account, in that is Type, which is an int in the database but i map it to a AccountType enum, this works fine, but if i go into the dbml designer and change something later on, it gets errors, so i have to change all int->enum mappings back to int, recompile and then set them again! has anyone else had this? kindest regards 

View 5 Replies View Related

Sorting By A Numeric In LINQ

May 15, 2008

Here's my LINQ code:pl = (from p in db.Table where p.ID == 1 orderby p.NumericField descending select p).Take(7);
As you can see, I'm trying to sort by a numeric field. Specifically, it's a Numeric(5,0) field.
Problem is, the results aren't coming back numeric order. If this is good LINQ code, perhaps it's something else in my app. I just want to make sure this LINQ code is good.
Thanks in advance

View 1 Replies View Related

Accessing StoredProcedure From LINQ

Jun 2, 2008

Can I know the best method to connect the sql server 2008 with Visual studio 2008, it will be helpful if I know how to access the stored procedures in the sqlserver via LINQ.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved