INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How represent CROSS JOIN load form when add combo national table

How represent CROSS JOIN load form when add combo national table

How represent CROSS JOIN load form when add combo national table

(OP)
Hi guys I have combobox i want to add in to fillcontroll() function but not accept
this is my data
Table driver
Driver ID
Driver Name
Nationality ID
ADDRESS

table nationality
nationality id
nationality name

in load form i want combobox display text is nationality name
and in same time i need to show when navigate record
this is my view in database
Driver1view
SELECT dbo.Driver.DriverName, dbo.Driver.Nationality, dbo.Driver.Address, dbo.Driver.NationalityID, dbo.Nationality.NationalityName
FROM dbo.Driver CROSS JOIN
dbo.Nationality

DataTable

DataSet ds = new DataSet();

SqlDataAdapter da = new SqlDataAdapter();

SqlConnection con = new SqlConnection();


private


in form load i write following


this.Cursor = Cursors.WaitCursor;
string constr = "Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "";
con = new SqlConnection(constr);
string comdstr = "select * from Driver1view";
da = new SqlDataAdapter(comdstr, constr);
ds = new DataSet();
dt = new DataTable();

da.Fill(ds,"Driver");

dt = ds.Tables["Driver"];

totalrecord = dt.Rows.Count;
this.Cursor = Cursors.Default;
if (totalrecord > 0)
{

fillcontrol();
}
else
{
MessageBox.Show("There is no records");
}

private

{totalrecord = dt.Rows.Count;






}

Now my problem is when I want to show combobox in load form it not show and it give me

errors why
















textBox1.Text = dt.Rows[currrecord]["DriverID"].ToString();

textBox2.Text = dt.Rows[currrecord]["DriverName"].ToString();

combobox.text = dt.Rows[currrecord]["NationalityName"].ToString();"

textBox4.Text = dt.Rows[currrecord]["Address"].ToString();"

label6.Text = currrecord+1 + "of"+ totalrecord.ToString();








void fillcontrol()int currrecord = 0;
private int totalrecord = 0;dt = new DataTable();

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close