M.Waqas Aslam 67 Posting Pro in Training Featured Poster

because your exhaust is not that much powerfull :P lolz
why every one asking stupid questions ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i know him , virus is my friend. :P
do you know about cold drink, name microsoft:P ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

because all sharks are eated by whale :P
why cant my computer do auto coding for me :P

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

no
do you know about daniweb ? :P

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

how many parents are their in world :P

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i think you should configure your sql server before .click on start --> microsoft sql server 2005 --> configuration tools --> sql server surface area configuration ---> surface area configuration for services and connections --> select remote connection option from the list on left side. then enable local connections and remote connections.
After doing above process , then again go on start--> microsoft sql server 2005 --> configuration tools--> sql server configuration manager --> sql native client configuration (left side list)--> check tcp/ip service is enable if it is disable then enable it and restart your mssql server.

After do above process , i hope you will able to connect your sql server remotly .

Regards

Reverend Jim commented: Welcome back. +12
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

there is no prob in your code.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

there are many ways to do so ,
1-If your application has database then store time and date of first run of your application and then check remaining days on load time.
2-If your application has no database then you can store installed date and time in registry of windows. and check remaining days every time you application loads.
3-simple way , just write a textfile , save date and time of first run in encrypted form. and check remaining days every time your application loads.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try something like this

reportViewer1.report= new myReport();

This code works for telerik reports. hope this will help you

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i ban you because your dp is cat.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

1-peace in world
2-food for all
3-education for all

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

no one will give you complete code . try to make it by your self. then in case of any issue post your query here. people of daniweb are not here to provide complete solutions.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i never used rdlc . but normally there are two methods to show data in report. 1- use wizard .2- set datasource to your report and map your fields with columns of datasource.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

as guru iyer said try to call the grdLoad method on the combobox selected index changed event and add connection to the sqldataadapter like this

SqlDataAdapter sqlDataAdap = new SqlDataAdapter(sqlCmd,con);

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you want to make log of specific applications or every thing user do ?. Please be more specific

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Please visit this link hope you find solution of your prob
Click Here

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i cant get your point ,i think you want to delete the selected record from the grid and also from db. you can do this on button click event after selecting your row from grid.

dim con as new sqlconnection("your connection string")
con.open()
dim cmd as new sqlcommand()
cmd.connection=con
cmd.commandtext="delete from table where recordid=" + datagrid.item("recId",datagrid.selectedIndex).value.tostring()
cmd.executenonquery()
con.close()
datagrid.rows.remove(datagrid.selectedindex)
'in this code recid is  assumed by me as it is present in your grid.

may be there are some spelling mistakes or other issues as i am from my phone. but hopefully you can get the idea .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try this

dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("select userId , userName from users",con)
dim dt as new datatable

da.fill(dt)
comboBox.datasource= dt;
with combobox
    .displaymember="userName"
    .valuemember="userId"
end with

con.close()

Hope this will help you

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if there is any control on form2 , you can just set focus to that control on the load event of your form 2. like

me.comboBox1.focus()

Hope this helps you.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

as tinstaafl said object reference is not set to an instance may occur if you create any instance with out new keyword. but this error normally comes when we get null value and assign it to some variable ,object etc. It is always better to convert null into empty string. or you can use

if(ds_company.Tables["tbl_Customer"].Rows[0] != null)
{
//your code --- 
}

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Hello !
If you are using windows form application and want to show the records from database to your from you can do like this .First add a textbox name txtSearch and then a button name btnSearch and a gridview name dgvSearch . now use this code.

sqlConnection cn = new sqlconnection("connection string");
datatable tbl = new datatable();
cn.open();
string strQuery = "";
strQuery = @"Select * from table1 where 1=1 ";

if(txtSearch.text != "")
{
strQuery = strQuery + " and field1 = " + txtSearch.text;
}
//---as above you can also use othere controls like datetime picker , combo box etc 
//to filter your records. just add conditions as mentioned above.
sqldataadapter da = new sqldataadapter(strQuery,cn);
da.fill(tbl);
cn.Close();
dgvSeach.datasource = tbl;

As i typed it here and this editor is not case sensitive so may be you have to change little bit.

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !

you can simple disable the datetimepicker like this

Me.dateTimePicker1.Enabled = false

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

in case if you have to use lots of images then reduce the size and resolution of images . then set the strech property of your image.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Dear All!

I want to get my columns value into rows . i am taking sum of qty of each month . like this

select sum(Case when month(invoicedate) = 1 then qty else 0 end) as janQty,
sum(Case when month(invoicedate) = 1 then qty else 0 end) as febQty,
sum(Case when month(invoicedate) = 1 then qty else 0 end) as marQty,
.
.
.
from Invoices 

above query is returning result like this
janQty---------febQty---------marQty-------------
--156-----------678-------------345------

and my required format is

janqQty------156
febqQty------678
marqQty------345
.
.
.

i can use union all like this this

select 'jan' as month, sum(case when month(invoicedate) = 1 then qty else 0 end ) as Qty
from invoice

union all

select 'feb' as month, sum(case when month(invoicedate) = 1 then qty else 0 end ) as Qty
from invoice

union all

select 'mar' as month, sum(case when month(invoicedate) = 1 then qty else 0 end ) as Qty
from invoice
.
.
.
.

But i dont want to use this method, Please guide me how i can do this in a simple way.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well it is better to first add all the records of your all players in a datagrid then insert them in db by using loop . if you are not able to use datagrid then use datatable , insert all records in it then then save them using loop.

If you have query regarding above mentioned methods ,Please Post your question here

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

for vs2008 win xp or 7 , and for vs2010 win 7 ,
just install vs your mssql server will auto installed with that setup , in case of vs2008 mssql 2005 will installed and in case of vs2010 mssql server 2008 will be installed.

after installation you just have install Mssql management studio .

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i think there is prob with your query , you are using this one

INSERT INTO Sensor Table (Equipment ID, Location, Supervisor, Alarm Start, Alarm Stop) Values (@Id, @Loc, @Sup, @Astr, @Asto)

in above mentioned query if your table name is sensor then remove word table after sensor , and if your table name is sensor_table then use underscore .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you can use three datatables for this , get required records for each datatable and then assign them to your grids.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well it is better to clear datagrid view

DataGridView.Rows.Clear()

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

i second you sir ancient dragon. vb.net is not able to make your own operating system but if you are very good in assembly and C then you can make a try . here is a book having detailed information about 32 bit operating system Click Here

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

what do mean by file , do you want to open text file ? or want to execute any application's exe file? .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

dataadapter get all data and put it in dataset at once ,but datareader get data line by line . so what i think dataadapter is faster then datareader.
one more thing in datareader data is only readonly .
here is a link please visit it for more information Click Here

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

here is a link , hope this will help you Click Here

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes you can do same by using datetime picker .try something like this,

'here is a code to show the data in grid 

dim con as new sqlconnection("your connection string")
dim strQuery as string 
strQuery = "select * from table1 where 1=1 "
'here is a code to add from date and to date , sometime if from date is selected and To date is not 
'not defined then this code will show all records having InvoiceDate equal to or greater then selected date
'same like to date.
if dateTimePickerFrom.text <> "" then 
    strQuery = " and InvoiceDate >= '" + dateTimePickerFrom.text + "'"
end if
if dateTimePickerTo.text <> "" then 
    strQuery = " and InvoiceDate <= '" + dateTimePickerTo.text + "'"
end if
con.Open()
dim da as new sqldataadapter(strQuery,con)
dim dt as new datatable
da.fill(dt)
datagrid.datasource = dt
con.Close()

i typed this code here so may be there are some spelling mistakes :P

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try something like this,

combobox.selectedValue= form1.gridview1.item(1,2).value.toString
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well if you want to run you application at the startup of windows then you can simply do this ,
when you make setup of your application in vs , you have 3 items on your left ,
1-application folder
2-user desktop
3-i dont remember right now:P

on this list right click-->a pop up window will appear --> select User start up folder form the list . and press ok
now a new item is added in your list , then select it , and press right click on the right panel and add shortcut same as we add shortcut in user desktop folder.

Done :P

when ever you will start your computer your application will executed.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

what i understand is that you have two forms , having datagrid , when you click datagrid1 on form one or select any customer form the grid then the second grid will populate with all related data of selected customer , if yes then you can do like this .

'use double click event of your datagrid and use this code
frm2.open()

'now use this code at the load event of your 2nd form.

dim con as new sqlconnection("your connection string")
con.open()
dim da as new sqldataadapter("select * from tableCustomerInfo where customerid = "+frm1.datagridview1.item("customerid",frm1.datagridview1.currentrow.index).value.tostring,con
dim dt as new datatable
da.fill(dt)
datagridview1.datasource= dt
con.close()

hope this will solve your prob.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please repharse your question i dont get you , well what i understand is that you want to filter your datagrid by selecting values from 2nd form ?

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

to insert record you can do this

dim con as new sqlconnection("connection string")
dim cmd as new sqlcommand()
con.open()
cmd.connection = con
cmd.commandtext="insert into table1 (field1,field2) values(@field1,@field2)"
cmd.parameter.addwithvalue("@field1",txtfield1.text)
cmd.parameter.addwithvalue("@field2",txtfield2.text)
cmd.executenonquery()
con.close()

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please explain little bit , ?what you want to do ? may be we can give to better solution .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

dont use this Trim(newQE_Date.ToString("MM-dd-yyyy HH:mm:ss")), just get value and insert it .

Regards

Hazuan Nazri commented: Nice!! +0
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

post your code which is not working

regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

how you are accessing the textbox in another form ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you can simply do this

//import the sqlclient library at the top like this
using System.Data.SqlClient;

'now you can connect to your database like this 
SqlConnection con = new SqlConnection(|"Data Source=YourServerAddress;Initial Catalog=YourDatabaseName;Integrated Security=SSPI;");
con.Open();
//here you can perform any database  operation using different objects like
//sqldataadapter
//sqldatareader
//sqlcommand
con.Close();

every time you want to perform any database operation you have to open and then close the connection.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Michael , where to use Close() ? can please explain it ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try this

class Calendar {

    public Calendar(ref NullableDateTimePicker Picker) {
    }
}

i use this site to convert code from vb.net to c#
Click Here

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

pgmer , sir i mean if a person change the system date of his computer then ? the agbenaza idea i think wont work.
and if you are make a encrypted file then i think you can just count the number of application is run by the user if you have limit of 30 times and user use this application 30 in a week then :P ? i think the best way to use windows registry for this .you can further visit the link i posted in my above post , you can better understand it :)

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

agbenaza if a person change date every time before runing the application then ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please ALWAYS post precis question , there is no time to read all your debugging information . what is your prob? ,tell us your prob in simple words.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

as pgmer said you have to populate your datagrid again each time when you insert , update or remove record,

Regards