Ask a Question related to ASP.NET General, Design and Development.
-
Learning SQL Server #1
Re: DataGrid binding... small problem... help please
Sorry if Im wrong, but couldnt you accomplish the same thing with a JOIN?
SELECT
M.SSN as 'SSNfromTableM',
M.LastName,
P.SSN as 'SSNfromTableP'
FROM Person P
INNER JOIN Midn M
ON M.SSN = P.SSN
Even so, assigning aliases to the columns with the same name should take
care of your problem...
"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
news:0f7e01c35ce7$66916030$a101280a@phx.gbl...> Hi. I have an SQL query which is something like this:
>
> SELECT M.SSN, M.lastName, P.SSN FROM Person P, Midn M
> WHERE M.SSN = P.SSN
>
> In the datagrid, if I wanted to output the SSN this does
> not work:
> <asp:BoundColumn HeaderText="Social" DataField="SSN" />
>
> It says that SSN does not exist, but last name works.
>
> I tried:
> <asp:BoundColumn HeaderText="Social" DataField="P.SSN" />
>
> and:
> <asp:BoundColumn HeaderText="Social" DataField="M.SSN" />
>
> What will work? I actually need it to enter the new data
> with something like newRow["SSN"]=... but is says that SSN
> does not exist. Thank you so much.
>
> Steven
Learning SQL Server Guest
-
Problem: Binding a datatable to RadioButtonList inside a DataGrid
Hi, I would like to do this (see below) but keep getting error. Any help is appreciated. thanks. I have a datagrid which display a search from... -
problem in binding xml file data to datagrid xml file isgenerated through JSP file
problem it that i am creating xml file using JSP file and i want to bind DataGrid with xml file data that is created using JSP but it will not Bind... -
Binding XML to Datagrid
Hi, I tried to bind an XML similar to the following to a datagrid. <Idontwant> <Iwant> <Yes></Yes> <Yes></Yes> <Yes></Yes> <Yes></Yes> -
Binding to Datagrid
hi friend I am developing web application in .NET using c#. I encounter a problem in binding the results to the datagrid. I have a storeprocedure... -
Binding a DropDownList in a DataGrid
none of these links to INDIA work... "Saravana" <saravank@sct.co.in> wrote in message news:O0#0lqDRDHA.3796@tk2msftngp13.phx.gbl...... -
Steven #2
Re: DataGrid binding... small problem... help please
I need that join to be there. I know that the fields have
the same name, which is why I named the tables P and M, so
I could call one field P.SSN and the other one M.SSN. I
just need to be able to output one. How can I do that?
Thank you.Though presumably they>-----Original Message-----
>That's because you are selecting 2 fields named SSN.might as well take the>should be the same, since you are joining on it. YouDataField="P.SSN" />>second one out.
>
>"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
>news:0f7e01c35ce7$66916030$a101280a@phx.gbl...>> Hi. I have an SQL query which is something like this:
>>
>> SELECT M.SSN, M.lastName, P.SSN FROM Person P, Midn M
>> WHERE M.SSN = P.SSN
>>
>> In the datagrid, if I wanted to output the SSN this does
>> not work:
>> <asp:BoundColumn HeaderText="Social" DataField="SSN" />
>>
>> It says that SSN does not exist, but last name works.
>>
>> I tried:
>> <asp:BoundColumn HeaderText="Social"DataField="M.SSN" />>>
>> and:
>> <asp:BoundColumn HeaderText="Social"data>>
>> What will work? I actually need it to enter the newSSN>> with something like newRow["SSN"]=... but is says that>>> does not exist. Thank you so much.
>>
>> Steven
>
>.
>Steven Guest
-
Marina #3
Re: DataGrid binding... small problem... help please
I didn't say to get rid of the join. I said to get rid of the redundant SSN
column in your select statement.
Since P.SSN and M.SSN are the same because of your where clause - why select
both columns?
If this is still not clear, I'm talking about a SQL statement like:
SELECT M.SSN, M.lastName FROM Person P, Midn M
WHERE M.SSN = P.SSN
"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
news:098d01c35cea$331ac180$a601280a@phx.gbl...> I need that join to be there. I know that the fields have
> the same name, which is why I named the tables P and M, so
> I could call one field P.SSN and the other one M.SSN. I
> just need to be able to output one. How can I do that?
> Thank you.> Though presumably they> >-----Original Message-----
> >That's because you are selecting 2 fields named SSN.> might as well take the> >should be the same, since you are joining on it. You> DataField="P.SSN" />> >second one out.
> >
> >"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
> >news:0f7e01c35ce7$66916030$a101280a@phx.gbl...> >> Hi. I have an SQL query which is something like this:
> >>
> >> SELECT M.SSN, M.lastName, P.SSN FROM Person P, Midn M
> >> WHERE M.SSN = P.SSN
> >>
> >> In the datagrid, if I wanted to output the SSN this does
> >> not work:
> >> <asp:BoundColumn HeaderText="Social" DataField="SSN" />
> >>
> >> It says that SSN does not exist, but last name works.
> >>
> >> I tried:
> >> <asp:BoundColumn HeaderText="Social"> DataField="M.SSN" />> >>
> >> and:
> >> <asp:BoundColumn HeaderText="Social"> data> >>
> >> What will work? I actually need it to enter the new> SSN> >> with something like newRow["SSN"]=... but is says that> >> >> does not exist. Thank you so much.
> >>
> >> Steven
> >
> >.
> >
Marina Guest
-
Jeff Adkins #4
Re: DataGrid binding... small problem... help please
Create an alias for each.
select m.ssn as m_ssn
, m.lastname as m_lastname
, p.ssn as p_ssn
from table1 M inner join table2 P on m.ssn = p.ssn
Using the inner join will improve performance.
Jeff
have>-----Original Message-----
>I need that join to be there. I know that the fieldsso>the same name, which is why I named the tables P and M,does>I could call one field P.SSN and the other one M.SSN. I
>just need to be able to output one. How can I do that?
>Thank you.>Though presumably they>>-----Original Message-----
>>That's because you are selecting 2 fields named SSN.>might as well take the>>should be the same, since you are joining on it. You>>second one out.
>>
>>"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
>>news:0f7e01c35ce7$66916030$a101280a@phx.gbl...>>> Hi. I have an SQL query which is something like this:
>>>
>>> SELECT M.SSN, M.lastName, P.SSN FROM Person P, Midn M
>>> WHERE M.SSN = P.SSN
>>>
>>> In the datagrid, if I wanted to output the SSN this>DataField="P.SSN" />>>> not work:
>>> <asp:BoundColumn HeaderText="Social" DataField="SSN" />
>>>
>>> It says that SSN does not exist, but last name works.
>>>
>>> I tried:
>>> <asp:BoundColumn HeaderText="Social">DataField="M.SSN" />>>>
>>> and:
>>> <asp:BoundColumn HeaderText="Social">data>>>
>>> What will work? I actually need it to enter the new>SSN>>> with something like newRow["SSN"]=... but is says that>.>>>>> does not exist. Thank you so much.
>>>
>>> Steven
>>
>>.
>>
>Jeff Adkins Guest
-
Steven #5
Re: DataGrid binding... small problem... help please
I tried this, and it said that SSNfromTableM does not
exist. It did not like the as 'SSNfromTableM'
and 'SSNfromTableP' statements. It would work if I
renamed the database variables, but I have so much code to
go through, that it would not be worth it. Is there
another way? Why do you think the "as" statement not
working? Thank you.
thing with a JOIN?>-----Original Message-----
>Sorry if Im wrong, but couldnt you accomplish the samename should take>
>SELECT
>M.SSN as 'SSNfromTableM',
>M.LastName,
>P.SSN as 'SSNfromTableP'
>FROM Person P
>INNER JOIN Midn M
>ON M.SSN = P.SSN
>
>Even so, assigning aliases to the columns with the sameDataField="P.SSN" />>care of your problem...
>
>
>"Steven" <stevenzilberman@alum.rpi.edu> wrote in message
>news:0f7e01c35ce7$66916030$a101280a@phx.gbl...>> Hi. I have an SQL query which is something like this:
>>
>> SELECT M.SSN, M.lastName, P.SSN FROM Person P, Midn M
>> WHERE M.SSN = P.SSN
>>
>> In the datagrid, if I wanted to output the SSN this does
>> not work:
>> <asp:BoundColumn HeaderText="Social" DataField="SSN" />
>>
>> It says that SSN does not exist, but last name works.
>>
>> I tried:
>> <asp:BoundColumn HeaderText="Social"DataField="M.SSN" />>>
>> and:
>> <asp:BoundColumn HeaderText="Social"data>>
>> What will work? I actually need it to enter the newSSN>> with something like newRow["SSN"]=... but is says that>>> does not exist. Thank you so much.
>>
>> Steven
>
>.
>Steven Guest



Reply With Quote

