jbisono 51 Posting Pro in Training

I do not understand clearly your question but, to answer how do you check if the gridview has any rows this is what I usually do.

if(yourgridview.Rows.Count > 0)
{
    //Has some rows
}
else
{
    //No rows
}
jbisono 51 Posting Pro in Training

The Button Control has two properties, OnClick="ServerSideMethod" OnClientClick="ClientSideMethod". So in the OnClick put your Delete Method and in the OnClientClick="return Confirm('Are you sure want to delete');" or call the javascript function...

jbisono 51 Posting Pro in Training

Don't mention it, we are here to help.

About your second question, you should start another Thread, so we can keep Daniweb's people happy.

If you want post the link of your new thread here, so i can get a email and i will answer your question.

jbisono 51 Posting Pro in Training

I going to recode what you have to update

1) protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
2) String ID = (GridView1.DataKeys[GridView1.SelectedRow.DataItemIndex].Value).ToString();

//Or I think you can do this.
String ID = GridView1.SelectedDataKey.Value.ToString();
jbisono 51 Posting Pro in Training

using System.IO;

File.Delete("Path");

That should do it.

jbisono 51 Posting Pro in Training

If you are using the AjaxControl Toolkit you can use the AlwaysVisibleControl here is a example of what it does http://www.asp.net/ajax/ajaxcontroltoolkit/samples/AlwaysVisibleControl/AlwaysVisibleControl.aspx

jbisono 51 Posting Pro in Training

1. if you use internet explorer, i think you will not get just text but the download option, but if you do get just text, you have to open a txt file in your computer, copy and paste the text you get in the website to your txt file and save it with the extension "js" so you will have a javascript file like jquery.js.

2. I think if you start reading the two tutorials below, you will have the answer for this question.

3. I believe jquery documentation is really nice, http://docs.jquery.com/Main_Page, and for css go here http://www.w3schools.com/css/default.asp

jbisono 51 Posting Pro in Training

to answer your question you have to concatenate the textbox like this

description.Text += ndate + Environment.NewLine + dnotes;
jbisono 51 Posting Pro in Training

Always!!! :)

jbisono 51 Posting Pro in Training

If you want you website to be view in all monitors you have to set the main div or body to 800px width, i actually don't use that width because now in these days a lot of people use at least a monitor with 1024 so that what i base my websites. it also depends the visitor you are expecting.

if you have any problem setting this, just post the code you have, and im sure that here in daniweb we can help you out.

jbisono 51 Posting Pro in Training

So im guessing that you have a LinkButton or something like that to trigger the rowcommand event.

I think i have used this before and it works.

int rowIndex = Convert.toInt32(e.CommandArgument);

if that one above dont work you can try this lets say again that the rowcommand is trigger by a linkbutton you will do this.

GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
int rowIndex = row.RowIndex;
jbisono 51 Posting Pro in Training

Great!!!.

jbisono 51 Posting Pro in Training

Try to use the property enabled instead of the ReadOnly to see what happens, i dont play too much with windows forms but in asp.net that would work.

jbisono 51 Posting Pro in Training

Use the technique that Fortinbra said!!! using auto margins....

jbisono 51 Posting Pro in Training

That error means that the your sending more parameters to the stored procedure that it supposed to received. just double check how many parameters do you have in your stored procedure.

jbisono 51 Posting Pro in Training

I have done that before, and never had a problem. all others styles got applied? is just that is not centered?

jbisono 51 Posting Pro in Training

I see that basically you want to fill a datagrid, there are some cases where is needed to use a datareader, lets say that you want to interact with the values returned from the database and create your own custom table, but if you going to display the data as is, i will fill a dataset or datatable better.

'I see you have two instance one for the SqlConnection "CON" and SqlCommand "CMD"

Dim dt As New DataTable
CMD.CommandType = CommandType.StoredProcedure
CMD.CommandText = "DTAAGRID_FILL_STAFF"
CMD.Connection = CON
CMD.Parameters.Add("@STAFF_ID", SqlDbType.VarChar).Value = Convert.ToString(CboStaffNo.SelectedValue)
CMD.Parameters.Add("@START_TIME", SqlDbType.DateTime).Value = Convert.ToDateTime(DTPFromDate.Value)
CMD.Parameters.Add("@END_TIME", SqlDbType.DateTime).Value = Convert.ToDateTime(DTPToDate.Value)
Dim adapt As New SqlClient.SqlDataAdapter(CMD)
adapt.Fill(dt)
dgbStaffInfo.DataSource = dt
jbisono 51 Posting Pro in Training

Why dont you use an int array to accomplish that?

jbisono 51 Posting Pro in Training

that statement goes like this

INSERT INTO mst_order_report(Capacity, Clearing_Alpha, Client_ID, Client_Order_ID,Cumulative_Executed_Size, Date_Of_Expiry, Entry_Time, Exec_Type, Executed_Qty,Executed_Value, Execution_ID, Hidden_Size, Inactive_Time, Order_ID, Order_Qty, Order_Status, Order_Type, Owner_ID, PAN_ID, Parent_Order_ID, Reason, Remarks, Side, Stop_Price, TIF, Total_Qty, Trade_Report_ID, Trader_ID, Transact_Time, Value, Visible_Size, Trading_Member_ID, Symbol)
SELECT Capacity, Clearing_Alpha, Client_ID, Client_Order_ID, Cumulative_Executed_Size, cast(Date_Of_Expiry AS date), cast(Entry_Time AS datetime), Exec_Type, Executed_Qty, Executed_Value, Execution_ID, Hidden_Size, cast(Inactive_Time AS datetime), Order_ID, Order_Qty, Order_Status, Order_Type, Owner_ID, PAN_ID, Parent_Order_ID, Reason, Remarks, Side, Stop_Price, TIF, Total_Qty, Trade_Report_ID, Trader_ID, cast(Transact_Time AS datetime), Value, Visible_Size, Trading_Member_ID, Symbol FROM order_report

just make sure everything match

jbisono 51 Posting Pro in Training

I have not figure out if there is another direct way to retrieve that info but this is what i do.

richTextBox1.SelectAll();
textBox1.Text = richTextBox1.Selection.Text;
jbisono 51 Posting Pro in Training

Unity3d Engine Love it, use javascript, c# and others but i use just these two ones.

jbisono 51 Posting Pro in Training

Yes it all depends what you want to do, we have to know a little bit more about you design and what you want to get, there are different ways to link it, cross join, left outer join, right outer join, inner join. im going to give you an example, the fact i dont have your design table i can't give you one with yours.

let's say you have to tables "Countries" and "States", Countries fields are (CountryID, CountryName) and States fields are (StateID, StateName, CountryID) now you can get all countries with states like this.

SELECT COUNTRY.COUNTRYNAME, STATE.STATENAME
FROM COUNTRIES AS COUNTRY INNER JOIN STATES AS STATE ON COUNTRY.COUNTRYID = STATE.COUNTRYID

IF YOU WANT TO KNOW ALL STATES FROM A SPECIFIC COUNTRY THE YOU HAVE THE SAME CODE JUST ADD A "WHERE" CLAUSE

WHERE COUNTRY.COUNTRYNAME = 'USA'
jbisono 51 Posting Pro in Training

You can't have a select statement in the "WHERE" clause unless you are kind of building a filter with a select statement in it.

SELECT SL_PL_NL_DETAIL.DET_TYPE, SL_PL_NL_DETAIL.DET_YEAR, SL_PL_NL_DETAIL.DET_PERIODNUMBR, SL_PL_NL_DETAIL.DET_DESCRIPTION, SL_PL_NL_DETAIL.DET_NOMINALDR, SL_PL_NL_DETAIL.DET_NOMINALCR, SL_PL_NL_DETAIL.DET_NOMINALVAT, SL_PL_NL_DETAIL.DET_COSTHEADER, CST_COSTHEADER.CH_NAME, NL_ACCOUNTS.NMAJORHEADCODE, NL_ACCOUNTS.NCATEGORYCODE1, NL_ACCOUNTS.NCATEGORYCODE2, NL_ACCOUNTS.NCATEGORYCODE3, NL_ACCOUNTS.NCATEGORYCODE5, NL_ACCOUNTS.NCATEGORYCODE6, NL_ACCOUNTS.NCATEGORYCODE7, NL_ACCOUNTS.NCATEGORYCODE8, SL_PL_NL_DETAIL.DET_NETT, SL_PL_NL_DETAIL.DET_VAT, SL_PL_NL_DETAIL.DET_GROSS, CASE WHEN SL_PL_NL_DETAIL.DET_NOMINALDR <> '' THEN SL_PL_NL_DETAIL.DET_NOMINALDR ELSE SL_PL_NL_DETAIL.DET_NOMINALCR END AS NOMINAL, SL_PL_NL_DETAIL.DET_NOMINALVAT
FROM NUSUKLIVE.dbo.CST_COSTHEADER CST_COSTHEADER, NUSUKLIVE.dbo.NL_ACCOUNTS NL_ACCOUNTS, NUSUKLIVE.dbo.SL_PL_NL_DETAIL SL_PL_NL_DETAIL
WHERE CST_COSTHEADER.CH_CODE = SL_PL_NL_DETAIL.DET_COSTHEADER
jbisono 51 Posting Pro in Training

So for the fiel DET_NOMINALDR and DET_NOMINALCR is one or the other try to do something simple like this.

SELECT COALESCE(DET.DET_NOMINALDR,DET.DET_NOMINALCR) AS NOMINAL, DET.DET_NOMINALVAT
FROM SL_PL_NL_DETAIL AS DET

now remember that a blank value and null is not the samething so coalesce will work if you have null values. if what you have is blank values then you need something like this

SELECT CASE WHEN DET.DET_NOMINALDR <> '' THEN DET.DET_NOMINALDR ELSE DET.DET_NOMINALCR END AS NOMINAL, DET.DET_NOMINALVAT
FROM SL_PL_NL_DETAIL AS DET

try to run that and check if you result just for that if what you want.

jbisono 51 Posting Pro in Training

it seems like you have two select statement, lets see how can we help you organize that statement. try to run this part of the statement and let us know if it work.

SELECT SL_PL_NL_DETAIL.DET_TYPE, SL_PL_NL_DETAIL.DET_YEAR, SL_PL_NL_DETAIL.DET_PERIODNUMBR, SL_PL_NL_DETAIL.DET_DESCRIPTION, SL_PL_NL_DETAIL.DET_NOMINALDR, SL_PL_NL_DETAIL.DET_NOMINALCR, SL_PL_NL_DETAIL.DET_NOMINALVAT, SL_PL_NL_DETAIL.DET_COSTHEADER, CST_COSTHEADER.CH_NAME, NL_ACCOUNTS.NMAJORHEADCODE, NL_MAJORHEADING.NL_MAJORNAME, NL_ACCOUNTS.NCATEGORYCODE1, NL_ACCOUNTS.NCATEGORYCODE2, NL_MAJORHEADING.NL_MAJORNAME, NL_ACCOUNTS.NCATEGORYCODE3, NL_ACCOUNTS.NCATEGORYCODE5, NL_ACCOUNTS.NCATEGORYCODE6, NL_ACCOUNTS.NCATEGORYCODE7, NL_ACCOUNTS.NCATEGORYCODE8, SL_PL_NL_DETAIL.DET_NETT, SL_PL_NL_DETAIL.DET_VAT, SL_PL_NL_DETAIL.DET_GROSS
FROM NUSUKLIVE.dbo.CST_COSTHEADER CST_COSTHEADER, NUSUKLIVE.dbo.CST_DETAIL CST_DETAIL, NUSUKLIVE.dbo.NL_ACCOUNTS NL_ACCOUNTS, NUSUKLIVE.dbo.NL_MAJORHEADING NL_MAJORHEADING, NUSUKLIVE.dbo.SL_PL_NL_DETAIL SL_PL_NL_DETAIL
WHERE CST_DETAIL.CT_NOMINAL = NL_ACCOUNTS.NCODE AND CST_COSTHEADER.CH_CODE = CST_DETAIL.CT_COSTHEADER AND NL_MAJORHEADING.NL_MAJORCODE = NL_ACCOUNTS.NMAJORHEADCODE

run that above


I DONT UNDERSTAND THIS PART "SELECT (CASE WHEN sl_pl_nl_detail.det_nominalcr IS NULL THEN sl_pl_nl_detail.det_nominaldr ELSE sl_pl_nl_detail.det_nominaldr END) AS some_name
"

YOU WANT TO DISPLAY THAT LAST PART OR YOU WANT TO CREATE SOME KIND OF FILTER WITH THAT?

jbisono 51 Posting Pro in Training

Is it that your full code? Because you are missing the "from" and "where" clause.

Eg. Select some_fields from some_tables where some_fields = some_values and some_other_fields = some_other_values.

jbisono 51 Posting Pro in Training
select case when sl_pl_nl_detail.det_nominalcr is null then sl_pl_nl_detail.det_nominaldr else sl_pl_nl_detail.det_nominaldr end as some_name

/*i think this can work for you too*/

select COALESCE(sl_pl_nl_detail.det_nominalcr, sl_pl_nl_detail.det_nominaldr) as some_name

/*or this*/

SELECT ISNULL(sl_pl_nl_detail.det_nominalcr, sl_pl_nl_detail.det_nominaldr) as some_name
jbisono 51 Posting Pro in Training

The problem to create the serial number in the product table is that you can have multiple serial numbers for the same product, like previously discuss if you order 10 pieces of a product you will have serial No from, let's say PRODUCT-001 TO PRODUCT-010, all serials No refer to the same product.

and each time you buy the same product will have different serial No. again.

jbisono 51 Posting Pro in Training

Hi
i believe you can do this.

DataView MyDataView = MyDataSet.Tables[0].DefaultView;

MyDataView.RowFilter = "IdCardNumber = "+Convert.ToInt32(textbox1.Text)+"";
MyDataGrid.DataSource = MyDataView;
MyDataGrid.DataBind();
jbisono 51 Posting Pro in Training

if what you want is save something in a session variable do this

Session["UserName"] = "MyUserName";
//to retrieve
String MyUserName = Session["UserName"].ToString();
jbisono 51 Posting Pro in Training

This is what i will do, reorder these lines like this

string query1 = "select [B]TOP 1[/B] is_Flush from mst_csv_upload where request_name = '" + tablename + "'";
SqlCommand cmd = new SqlCommand(query1, connection_string);
connection_string.Open();
string flush_flag = (string)cmd.ExecuteScalar();
connection_string.Close();

also consider that if the result set of your query is null and you try to parse that to string, that will trigger an error if i recall.

regard.

jbisono 51 Posting Pro in Training

Refer to this thread http://www.daniweb.com/web-development/databases/ms-sql/threads/190891

there are two solutions in there.

jbisono 51 Posting Pro in Training

personally i have never worked with passport authentication but this is what it is "Passport authentication points to a centralized service provided by Microsoft that offers a single login and core profile service for any member sites. It costs money to use Passport, which has also recently been depreciated
by Microsoft."

In the other hand Windows authentication in a nutshell will automatically authenticate connections between IIS and Active Directory, It is the way to go if you are working in a Intranet environment. Basically if you running a web app with windows authentication any valid windows user can login to your application.

jbisono 51 Posting Pro in Training

Simple, you can you web services in anything you want, the BIG Point is that if you create some web services, programmers can consume those web services with any programming language.

Example, lets say you have a manufacturing company, and for some reason you want to give your customers the latest info about your products, you can say well i can put that y my website and display the info i want in there, well true but what about if you want for some reason customer can integrate your products with some kind of programming in their end. so you can create a web service that return all the info of my products and you can build your service in c# but they can consume it using java. or whatever programming they do.

Got it?

jbisono 51 Posting Pro in Training

Ok i wanted to make sure we are in the same page :).

i did something similar but with the customer order process, anyway what about if you create another table with the Purchase_order, Line_No or Part_No (dont know how your table are set up) but basically for each purchase order -> part No you can have multiple serial No. then you will be able to enter as many serial no as you order qty.

this is how you can make it easier for the person who is entering the data, if you order 10 pieces and the manufacturer give this no as serial no sn100-001 after the dash is an incremental No. up to qty order then you can do some programming to generate 10 serial No. because is not funny have a order qty of 100 parts and entering that manually you have to find a convention how you can generate those serials no.

I have seen people using an excel sheet also to import that to the tables.

debasisdas commented: good suggestion. +9
jbisono 51 Posting Pro in Training

if you want just one row one column in return use in the select statement do this
SELECT TOP 1 REGRA FROM TblUsuariosExecutive WHERE Nome = 'victor'

then in the SqlCommand execute the ExecuteScalar method that will return just one value as an Object just convert that to your data you are expecting.

jbisono 51 Posting Pro in Training

There are few thing that i should revise here.
1. when you make a instance of the SqlCommand with the Name of the stored procedure and the SqlConnection you do not have to set the CommandText property of the SqlCommand, you can delete that line.

2. I see you execute the method Read() of the DataReader with out the while loop, you dont have to do that, just do this while(Reader.Read()){code here}

3. When you finish reading thru the DataReader you have to execute the method Close of the DataReader.

first fix these things try to run and let me know what do you get.

jbisono 51 Posting Pro in Training

About the first question when you say by the manufacturer sounds like you are acquiring the product thru a purchase order right? if that is true then i will save the serial no in the purchase order line item. Note: what happened if you are ordering 10 pieces for the same product? does that means you have 10 different serial no's?

for the second question once you have your purchase order now you have your products with the serial no too.

let me know if i help you a little bit with this, maybe you can explain better.

jbisono 51 Posting Pro in Training

Personally i use the property enabled="False" if i want no body touch that textbox, in the only situation i use read only is when play around with gridview.

regards

jbisono 51 Posting Pro in Training

Uhmm to be honest im more with c# but i always say that it is the same thing, in the only other thing that i can tell you is, in your aspx page the button whosoncallbutton you have to add the property onClick="whosoncallButton_click"

also, check again the connection, the name of the stored procedure and the parameters.

if that does not work instead of filling a datatable try to fill a dataset and add the dataset as datasource, just to test.

jbisono 51 Posting Pro in Training

First, you dont need this line cmd.ExecuteNonQuery()
Second, when using fill a dataset thru an adapter you dont need to open and close the connection that is done automatically.

everything looks good just take out the cmd.ExecuteNonQuery()

jbisono 51 Posting Pro in Training

If you want to do some cool stuff and does not want to mess the performance of the system, try to use javascript.

jbisono 51 Posting Pro in Training

you need to select just the age, the fact that you are grouping by name, the only time it will give you the maximum age is if you have two records example
Paul 20 and Paul 40 then that will return Paul 40. but for each name will return his age.

if you want just the oldest name and age try something like

SELECT TOP 1 name, age
FROM         man
ORDER BY age DESC

you should consider that could be more than one person with the same oldest age.

hope that helps

jbisono 51 Posting Pro in Training

you can know what the user click, the confirm method return true if the button press was Ok, so you can have something like

if(Confirm("Are you sure want to insert this?") == false)
{
   //method for false
}

you can assign the return to a var too and then do whatever you need

var a = Confirm("are you sure about this?");
if(a == true)
   //if click ok
else
   //if click cancel

hope that helps

jbisono 51 Posting Pro in Training

i will assume that you are using a asp.net control button for this.

<asp:Button ID="btnSave" runat="server" OnClick="Server_btnSave_Click" OnClientClick="Client_btnSave_Click" Text="Save" />

now you can add in your codebehind the Server_btnSave_Click method and in javascript write your method for Client_btnSave_Click, that way when the user click the button the first thing to run is the client side script and there you will have your confirm statement, and the workflow will continue depends on what the user click, ok or cancel...

jbisono 51 Posting Pro in Training

You can use "SelectParameters" and then add the value of the parameter in the code behind

<asp:SqlDataSource //Instance Properties
SelectCommand="SELECT * FROM categorymaster WHERE catgroup in (@vgroup)">
   <SelectParameters>
      <asp:Parameter Name="vgroup" />
   </SelectParameters>
</asp:SqlDataSource>

then in the background you can do this
sorry this is c# but vb should be very similar

SqlDataSource1.SelectParameters.Clear();
SqlDataSource1.SelectParameters.Add("vgroup", "1,7");

and then bind your DataSource...
Hope that helps

jbisono 51 Posting Pro in Training

do something like this

DELETE FROM MAIL INNER JOIN PHONE ON MAIL.MID = PHONE.PID
WHERE PHONE.PID = 12
jbisono 51 Posting Pro in Training

8000 records, that is definitely a lot.
first: if you are saying it is mandatory to have a dropdownlist in there, then i will think a way to group the records, kind of "Category and Sub-Category", in that case you will have two dropdownlist, one to filter the other one.

Second: sometimes i use an AutoComplete textbox like this AjaxControlToolkit AutoControl, but then you wont have the dropdownlist.

if i think in something else i will let you know...

jbisono 51 Posting Pro in Training

anytime happy coding to you too!!!

jbisono 51 Posting Pro in Training

You can try this, is the first thing comes to my mind, in your Page_Load Method do this.

foreach(ListItem li in RadioButtonList1.Items)
{
   li.Attributes.Add("onClick", "CheckChange('" + li.Text + "','" + li.Value + "')");
}

Then just create a javascript function called CheckChange, li.text and li.value are parameters

Hope that helps!!!