Moti Mashiah
asked on
C# with database
Hi Guys ,
I have built new application and I'm trying to query some tables and columns from the database see could below: and also screenshot of my issue
I have built new application and I'm trying to query some tables and columns from the database see could below: and also screenshot of my issue
string conn = "Data Source=srv-db-02;Initial Catalog=rmsmasterdbtest;Persist Security Info=True;User ID=test;Password=masterB4";
//string Query = "select * from rmsmasterdbtest.dbo.PurchaseOrder where ponumber= '" + combopo.Text + "' ;";
string Query = "select d.PONumber, b.ItemLookupCode, a.SerialNumber, a.SerialNumber2, a.SerialNumber3"
+ "from rmsmasterdbtest.from dbo.Serial AS A"
+ "inner join dbo.item AS B on b.id = a.ItemID"
+ "inner join dbo.PurchaseOrderEntry AS C on C.ItemID = b.ID"
+ "inner join dbo.PurchaseOrder AS D on D.ID = c.PurchaseOrderID"
+ "where ponumber= '" + combopo.Text + "';";
SqlConnection Myconn = new SqlConnection(conn);
SqlCommand cmdDataBase = new SqlCommand(Query, Myconn);
SqlDataReader Reader;
try
{
Myconn.Open();
Reader = cmdDataBase.ExecuteReader();
if (Reader.Read())
{
string stime = Reader.GetDateTime(Reader.GetOrdinal("SerialNumber2")).ToString();
string sstatus = Reader.GetString(Reader.GetOrdinal("SerialNumber3"));
txtdate.Text = stime;
txtstatus.Text = sstatus;
Capture.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect!!
Oh dear, really the answer was from Paul Jackson, mine was just a preference.
I'm able to re-open this for you for a split of points, just ask.
btw: no need to feel silly, we have all done things like this, me all too often :)
I'm able to re-open this for you for a split of points, just ask.
btw: no need to feel silly, we have all done things like this, me all too often :)
ASKER
Sorry guys I didn't pay attention I'm going to divide the point.
Thank you very much.
Thank you very much.
ASKER
Please reopen the question
ASKER
solved
Thanks!
ASKER
Thank you very much it works now.