my connection code is:
String strConnection;
strConnection = "server=localho st;User ID=sa;Password= sas;database=db ";
SqlConnection conn = new SqlConnection(s trConnection);
conn.Open();
how will i write it in any application configuration file working in windows form,and call it on every page that needs to b connected??
can any body help me??
User Profile
Collapse
-
connection code in app-config file in windows form
-
update dataset
i m using dataadapter to handle dataset..the date is shown in the datagrid..now i want to update the records edited by the user
i have used one button to show the records,(in which i hv declared dataadapters and dataset)
and behind "edit record" button i want to write the code for updation
if i use the command
DataAdapter.Upd ate(Dataset);
what should i do as the dataadpter... -
wild card characters
wild card characters are used to match strings as
select * from table where name LIKE '%brown%';
but doesnt supports matching of dates,number
what will we do if we want approximate matching of dates and numbers?? -
if(combobox2.te xt==" teachers name")
str="t_name"; //giving field name
//many if statements here
strQuery = " SELECT * FROM tbl1,tbl2,tbl3 WHERE tbl1." + str + "=" + textBox1.Text+" AND
tbl1.t_id=tbl2. tb_id AND tbl.t_id=tbl3.t b3_id ";
it works
but when i do
//tablename=combo box1.text;
//or
tablename="tbl1 ";... -
having problem in Select statement
in my windows form,for search,two combo boxes are provided.the first one gives the table names and in second combo box the respective fields are provided ,by selecting any field the user enters the required value according to which te search is done
i m storing both tablename and field name in string
now in my select statement when i append the string with field name (with hard coded table name); it functions well but when... -
thank u...but my code worked i.e.:
strQuery = " SELECT * FROM tbl1,tble2 ";
SqlCommand com1 = new SqlCommand(strQ uery, conn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter( com1);
da.Fill(ds, "tbl1");
da.Fill(ds, "tbl2");
...Leave a comment:
-
-
fill dataadpter with more then one table
i want to fill dataadapter with more then one table what will be the syntax for it and binding more then one datamembers(tab les) with grid -
-
hmmmm but as i told i m working in windows application and it doesnt support databind option
is there any replacement or any directives/namespaces to include?
and what if i want to update records using dataset?...Leave a comment:
-
well! isnt there any need to use data reader??
well my code is
//connection as conn
strQuery = " SELECT * FROM table";
SqlCommand com1 = new SqlCommand(strQ uery, conn);
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter( );
SqlDataReader dr = com1.ExecuteRea der();
if (dr.Read())
{
da.Fill(ds,"tab le");...Leave a comment:
-
-
binding data to datagrid
in windows apllication, i want to select table's data and show it in datagrid
but i dont undertand how will i bind the data
is there any way to use datagrd view manager or something like this????
m confused!!! -
connecting to sql server using application configuration file
i m working on widows application..fo r connectivity to sql i want to give datasource in app file..and in every page i wan to call that string
but i dont understand how to do that
can anyone help me?? -
-
-
i tried it... there was no error on debugging but when i tried inserting values and clicked on save button the following exception was handled
Index was outside the bounds of the array....Leave a comment:
-
Error 1 The best overloaded method match for 'System.Data.Ol eDb.OleDbDataAd apter.OleDbData Adapter(string, string)' has some invalid arguments
Error 2 Argument '2': cannot convert from 'System.Data.Sq lClient.SqlConn ection' to 'string'...Leave a comment:
-
-
data adapter
i m creating a data adapter but is not working..is it the correct way??
[CODE=css] OleDbDataAdapte r da = new OleDbDataAdapte r(strQuery, conn);
da.Fill(ds, "table name");[/CODE]
No activity results to display
Show More
Leave a comment: