Hey Guys, I have a question... I want to display data from two different tables into a single datagrid view. Problem is i dnt wana join the tables. pls check this code [code]private void bindgrid() { SqlConnection con = new SqlConnection(connStr); con.Open(); str1 = "Select * from wcl_et "; str2 = "Select * from secl_et"; str3 = "select * from sccl_et"; ad = new SqlDataAdapter(str1, con); ad.Fill(ds1, "wcl_et"); ad = new SqlDataAdapter(str2, con); ad.Fill(ds2, "secl_et"); //ds1.Merge(ds2); dataGridView1.DataSource = ds1.Tables[0].DefaultView; //dataGridView1.DataSource = ds1; //dataGridView1.DataBindings(); } private void Form1_Load(object sender, EventArgs e) { bindgrid(); } private void button1_Click(object sender, EventArgs e) { …

Member Avatar
Member Avatar
-2 forum 10

Hello all, It has been long since i am facing this problem. I want to convert my datagridview data to pdf format. I have searched a lot but couldnt find any. Need your help. Regards, Ajinkya

Member Avatar
Member Avatar
+0 forum 4

Hey people, I have a question. I may sound like a person with no knowledge. Isn't there any other control than datagrid or datagridview, to display data from table. Please help me to know more about this. Regards ajinkya

Member Avatar
Member Avatar
+0 forum 1

Hey guys, Here's the thing. I have a database in MS access. I have made an application that has to access this DB. Now this database is on another machine. Lets call it pc1. pc1 and my machine are in same wireless network. But when i try to connect to the database connection fails. Do need to put on internet or is there a workaround for this? let me put connection string i am using for this. Please let me know if there's anything wrong with it. [CODE]Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\xxx.xxx.xxx.xxx\\C:\\Users\\user1\\Documents\\DB1.accdb;[/CODE] Thanks Ajinkya

Member Avatar
Member Avatar
+0 forum 3

Hello people, I have an application that updates a table. In this application i have a combobox where i load id of record on form load. Let me paste my code to be more clear about my problem. [CODE] Private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string q = "Select AREA, [PAYING AUTHORITY],[PURCHASE ORDER No], [BILL No], [BILL DATED], [MATERIAL VALUE], [BILL VALUE], [AMOUNT PASSED] , [SUPPLY PARTICULAR], [PAYMENT DETAILS], [C-FORM No], T_ID from transact1 where t_id = '" +comboBox1.SelectedItem+ "' "; SqlCommand cmmd = new SqlCommand(q, on6); SqlDataReader drr = cmmd.ExecuteReader(); while (drr.Read()) { //MessageBox.Show("Record With this Transaction Exist. …

Member Avatar
Member Avatar
+0 forum 1

Hey guys, I have an application that connects to DB that is on a remote PC. Problem is after a couple of minutes or so, it starts throwing exception. 1. The specified network name is no longer available. 2. Connection was forcibly closed by remote host. 3. connection was closed by software on the remote machine. I couldn't find any solution for these problems. Please help me with this one. Thanks and regards ajinkya

Member Avatar
Member Avatar
+0 forum 3

Hey guys, I have got a problem. I have an application that shows data in datagridview. Now, I want to add 'Print' option in it. I want to it print only those that are selected. I have tried a code but it didn't help at all. Please suggest me something about. Any kind of help is appreciated! Thank you Ajinkya

Member Avatar
Member Avatar
+0 forum 6

Hey people, I have a simple application which inserts data into database. The database is located on a remote machine. However this machine(which has SQL) has a router installed. My pc(which has application) can find this machine's IP address by using a code. Everything is okay till this stage. Now when I try to insert data into DB it gives me error "No Such Host Found". As these machines are connected through same router, so i need to ask that do i have switch on internet everytime I try to insert data Or is there any other way around this …

Member Avatar
Member Avatar
+0 forum 2

Hey Guys, I have gotta problem. I want to store data into database(which i can do) from C# application. Now the thing is every time I insert or update, I want my application to catch that transaction, create a 'TRANSACTION ID', and store it in table. So that it would be easier for me to update and delete the data. Any idea how can I do this? Thanks Ajinkya

Member Avatar
Member Avatar
+0 forum 1

Hey guys, I have written a code that could delete selected row in data grid view. I gives lots of errors. Let me paste my code. [CODE]for (int i = 0; i < dataGridView1.Rows.Count; i++) { DataGridViewRow dr = dataGridView1.Rows[i]; if (dr.Selected == true) { dataGridView1.Rows.RemoveAt(i); cmd.CommandText = "Delete from transact1 where C_ID ='" + i + "'"; cmd.ExecuteNonQuery(); da.Update(ds, "transact1"); MessageBox.Show("Deleted"); } con1.Close(); }[/CODE] While deleting row it throws exception. "Connection property not initialized" I have tried opening connection in different ways but it didn't help either. So can anyone tell me what can possibly wrong with this code? …

Member Avatar
Member Avatar
+0 forum 1

Hey Guys, I am now loosing my cool over this problem. let me paste my code an then i'll explain my problem. Here's my code : [CODE] if (rn < ds1.Tables["Company"].Rows.Count-1) { rn = rn + 1; textBox1.Text = ds1.Tables["Company"].Rows[rn].ItemArray[0].ToString(); SqlDataAdapter da1 = new SqlDataAdapter("Select C_ID from Company where C_NAME ='Germany'", con2); da1.Fill(ds1, "Company"); [/CODE] Here, I have a textbox that should show the id of company that is selected by user from combo box. But somehow it keeps on nudging me error : Object reference not set to instance of an object. I tried all possible ways but couldn't …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone, From couple of days i am trying to write a code that would generate Id automatically and store it in table. I have a table "STU". It has two columns Id and Name. I have taken a form which has two text boxes and a button. text box1 is for ID and it is disabled, textbox2 is for name where user has to enter a name. I want the ID which is generated automatically, to be displayed in textbox1 and then store it with the name that user has entered in textbox2. If anybody can suggest a code …

Member Avatar
Member Avatar
+0 forum 5

Hey guys, I am trying to write down a code for generating 'ID' automatically and then store it in table. There some errors, i couldn't rectify. This is my code : [CODE] int ctr = 1; int len; DataTable dt = new DataTable(); DataRow dr; DataSet ds = new DataSet(); string code; string cde; dt = dB1DataSet1.Tables["TT"]; [COLOR="Red"]len = dt.Rows.Count - 1;[/COLOR] [COLOR="Green"]//Error : did not declare object instance.[/COLOR] dr = dt.Rows[len]; code = dr["ID"].ToString(); [COLOR="Red"] cde = code.Substring(1,3)[/COLOR]; [COLOR="Green"]//Error : Start index cannot be greater than length of the string.[/COLOR] ctr = Convert.ToInt32(cde); if ((ctr <=1) && (ctr < …

Member Avatar
Member Avatar
+0 forum 4

Hey guys, I need a code that would delete the row from not only from grid view but also from the table. I am able to delete the row from grid view but its not getting deleted from table. Any suggestions on how to do it. Regards Ajinya

Member Avatar
Member Avatar
+0 forum 4

Hey people, I have a database that is stored on a remote machine. In my application i have used connection string with IP address of that remote machine. Now, the problem is every time the remote machine is turned on it has a new IP address. Is there any way that i can get that newly generated IP address stored in connection string automatically every time i try to connect to database. Here's my connection string : [CODE][COLOR="Red"]Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword; [/COLOR] [/CODE] NOTE : Its not a web application. thanks

Member Avatar
Member Avatar
+0 forum 7

Hey guys, I have two forms, form1 and form2. My form1 has a combo box and a button. Here's form1 code. [COLOR="Red"][B]Form1[/B][/COLOR] [CODE] public partial class Form1 : Form { bool s; public Form1() { InitializeComponent(); s1 = comboBox1.Text; } private void Form1_Load(object sender, EventArgs e) { } public string s1; private void button1_Click(object sender, EventArgs e) { s = true; Form2 oj = new Form2(s1); oj.Show(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } } public struct forms1 { public string s; public forms1(string s) { this.s = s; } public string text() { return "this was selected" …

Member Avatar
Member Avatar
+0 forum 4

Hey people, I want to make an application which would be connected to a database. It would retrieve data make changes and store it in database again. I have figured on how to make this application. But the real catch is i want database to be stored on a single machine. How do i make it the way so that it would get updated from any other machine which is connected to it in either LAN or via wi-fi. Any ideas? Thanks

Member Avatar
Member Avatar
+0 forum 4

I need to know if it is possible to store click event of a button in a variable. I tried doing it but didn't get any solution. Please help Regards

Member Avatar
Member Avatar
+0 forum 3

Hi people I need some help here. Here is the CODE : [B]for Form1:[/B] [CODE] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace practice { public partial class Form1 : Form { Form2 obj; public Form1() { InitializeComponent(); } string str1 = "Data Source=Blackgold;Initial Catalog=MIS;Integrated Security=True"; private void button1_Click(object sender, EventArgs e) { string s = comboBox1.SelectedIndex.ToString(); obj = new Form2(s); obj.Show(); } private void Form1_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(str1); con.Open(); SqlCommand cmd = new SqlCommand("Select Name from company", con); SqlDataReader dr = cmd.ExecuteReader(); …

Member Avatar
Member Avatar
+0 forum 5

Hey Guys, Currently, I am doing a project. I don't know how to pass a value from one windows form to another windows form using c#.net. Suppose, I have two forms parent form and child form. Parent form consists of a combo box & button and I want to pass selected item of combo box to my child form and that item will be showing in a text box of child form. How can I do that? Thanks and Regards

Member Avatar
Member Avatar
+0 forum 6

Hey guys, need your help once again. I want to create a global variable in one form and then use it in another form. I need to know of it is possible. If yes, then how do we do it. Thanks And regards

Member Avatar
Member Avatar
+0 forum 2

Example : suppose i have a form1 and a form2. form1 has a button on it which would display a message "Clicked" when clicked And if form2 inherits form1. How can i change the properties of that button and make display a message "Now Clicked" ? please help.....:?:

Member Avatar
Member Avatar
+0 forum 1

How do i create two tables in a database at same time from a windows form.?? how do i give them same name??

Member Avatar
Member Avatar
+0 forum 4

i need to ask one more question.... [CODE]private void bbn_Click(object sender, EventArgs e) { OleDbDataAdapter ad; DataSet ds1 = new DataSet(); if (comboBox1.SelectedIndex == 0) { string str1 = "select * from '"+comboBox1.SelectedIndex+"'"; OleDbConnection conn1 = new OleDbConnection(str); ad = new OleDbDataAdapter(str1, conn1); ad.Fill(ds1); dataGridView1.DataSource = ds1.Tables[0].DefaultView;[/CODE] i want the button to select the data from combo box and then display the corresponding table in grid view... however its giving me an error [CODE]ad.Fill(ds1)[/CODE] here... it says syntax error..i know i need to write table name there...but i want it to read it from my [CODE]combobox.seleted index[/CODE].... Any suggestions.... thanks …

Member Avatar
Member Avatar
+0 forum 1

Hey folks, I am making an application where i want to create some controls dynamically. for instance..i hv a text box that takes the name of table and stores it in database. Now, the thing i want is everytime a name is added and table is created...at the same time a form should also get created in order to display the data of recently created table. pls help me this...please....

Member Avatar
+0 forum 0

The End.