Re: need help
From: Bob Boran (mcsdsmurf_at_hotmail.com)
Date: 02/24/04
- Next message: gabriel: "Re: No .NET framework"
- Previous message: Patrick Steele [MVP]: "Re: How can I tell waht permissions an assembly requires?"
- In reply to: Mike: "need help"
- Next in thread: Mike: "Re: need help"
- Reply: Mike: "Re: need help"
- Messages sorted by: [ date ] [ thread ]
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.)
>
>
- Next message: gabriel: "Re: No .NET framework"
- Previous message: Patrick Steele [MVP]: "Re: How can I tell waht permissions an assembly requires?"
- In reply to: Mike: "need help"
- Next in thread: Mike: "Re: need help"
- Reply: Mike: "Re: need help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|