Re: need help

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Bob Boran (mcsdsmurf_at_hotmail.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 11:12:24 -0700

There are 2 items I can see.
1.) this is probably not it, but using Trusted Connections in an aspx
application can be problematic as the User of the app is usually a
non-trusted guest account. Is the SQL Server you are hitting a local
install in both cases?
2.) your sql statement is doing a join where the ON clause is between a
field in Task and a parameter. Shouldn't you be joining ON 2 fields, and
whereing the parameter? We would need to see the Table Defs for the 2
tables to give any better advice, I think.

"Mike" <csharpcoder@sbcglobal.net> wrote in message
news:ebGEd4v#DHA.2072@TK2MSFTNGP11.phx.gbl...
> I have an asp.net page in C# and this code does not when I point it to my
> database, it works fine going against the pubs sql db but not mine
>
> String selectCmd = "SELECT dbo.Task.emailAddress, dbo.Task.tasks,
> dbo.Task.datePosted, dbo.Task.comments FROM dbo.Team INNER JOIN dbo.Task
ON
> dbo.Team.ID = @me";
>
> SqlConnection myConnection = new
>
SqlConnection("server=servername;database=techForum;Trusted_Connection=yes")
> ;
> SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);
>
> myCommand.SelectCommand.Parameters.Add(new SqlParameter("@me",
> SqlDbType.NVarChar, 2));
> myCommand.SelectCommand.Parameters["@me"].Value =
> MySelect.SelectedItem.Value;
>
> DataSet ds = new DataSet();
> myCommand.Fill(ds, "Task");
> MyDataGrid.DataSource= ds.Tables["Task"].DefaultView;
> MyDataGrid.DataBind();
>
>
> what it does is populate a grid depending on what the user selects in the
> drop down. Note: this same exact code does work when i point to the pubs,
or
> nwind database, (just need to change the query.)
>
>



Relevant Pages

  • Re: select case statement in vba
    ... i tried that exact code and it ... being used as a complete sql select statement. ... thanks, dave ... would be to the Access VBA Select Case ...
    (microsoft.public.access.adp.sqlserver)
  • Re: SQL CE Supported Queries
    ... > I am posting the exact code which i am using. ... SQL Server CE. ... I do see two syntax errors, but that is not the most serious problem with ...
    (microsoft.public.sqlserver.programming)
  • Re: Storing a date field without a value
    ... I would use some If IsNullstatements to build your SQL ... "Kevin Sheardy" wrote in message ... > "Rick B" wrote: ... >> Post the exact code you are using and tell us what the exact error is. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: null fields
    ... Here is the exact code I wrote ... "MGFoster" wrote: ... >> IS NOT NULL) in the SQL view on the query but it still doesn't work, ...
    (microsoft.public.access.queries)