Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kirannatt
Yak Posting Veteran
66 Posts |
Posted - 2004-08-03 : 14:58:36
|
Hi all,I want to assign two sql statements to one string. and then I want to get ordinal from two different tables.e.g.String getData = "select address2 from consumeraddress,consumer,consumeraccount where consumeraddress.consumerguid=consumer.consumerguid and consumer.consumerguid=consumeraccount.consumerguid and accountnumber='"+this.logID+"';select employername from consumeremployment,consumer,consumeraccount where consumeremployment.consumerguid=consumer.consumerguid and consumer.consumerguid=consumeraccount.consumerguid and accountnumber='"+this.logID+"'";I am trying to get ordinals of address2 and employername like this.int streetNameO = dr.GetOrdinal("address2");int empNameO = dr.GetOrdinal("EmployerName");I am receiving 0 value for both column. I think it is bcoz of tables .If I put one statement then everything is right. I don't know how to specify tables to get ordinali am wondering if anyone can help me out.Thanks,Kiran |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-08-04 : 05:03:49
|
DataAdapter.SelectCommand = getData;DataAdapter.Fill(ds);foreach(DataRow dr in ds.Tables[0].Rows){ int streetNameO = dr.GetOrdinal("address2"); int empNameO = dr.GetOrdinal("EmployerName");}if this doesn't work for you (it does for me), maybe you need TableMappings.Go with the flow & have fun! Else fight the flow :) |
 |
|
|
|
|