jbisono 51 Posting Pro in Training

Ok, how are you passing the result set to the datagridview? threw a DataReader or DataSet, their both have a method that return if there is data.

DataReader.HasRows(), return true is the reader has any data.

DataSet.Tables(0).Rows.Count Return how many rows were retrieve by the statement as integer.

hope that help you, regards.

jbisono 51 Posting Pro in Training

I think you can do that.

$Statement = "Select * from profile where age between " . $age_from . "and " . $age_to.";
jbisono 51 Posting Pro in Training

jeje got it, thanks ddanbe. I forgot about the consistency of Microsoft Products.

jbisono 51 Posting Pro in Training

Uhmm, Are we talking about the same control?
I think I misunderstood the question, you guys are talking about CheckedListBox and I am talking about CheckBoxList jeje, well anyway if there are different controls my post have no sense.

Thanks. hope you solve your issue soon.

jbisono 51 Posting Pro in Training

First step is to split the string into an array.

string MyString = "Games,Tvs,Shows";
string[] MyArray = new string[3];
MyArray = MyString.Split(',');
CheckBoxList1.DataSource = MyArray;
CheckBoxList1.DataBind();

and the second question I do not really understand but this is what i think.

private string GetIndex(string descr)
    {
        int i = 0;
        foreach (ListItem li in CheckBoxList1.Items)
        {
            if (li.Text == descr)
            {
                return i.ToString();
            }
            i++;
        }
        return "";
    }

In order to get the value call the function like this String CheckIndex = GetIndex("Shows"); should return 2
Regards

jbisono 51 Posting Pro in Training

well If you know how to make a connection with the database which i think you do, because you are getting data from the db. to insert a new record is much easier.

lets say that we have a table like this
Person
Name
LastName
Address

Dim insertStatement  As String
insertStatement = "INSERT INTO Person (Name, LastName, Address) VALUES ('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"')"
Dim cmd As New System.Data.SqlClient.SqlCommand(insertStatement, Conne)
Conne.Open()
cmd.ExecuteNonQuery()
Conne.Close()

Which TextBox1.Text Contain the name or could be a string variable.
TextBox2.Text Contain the Last Name and TextBox3.Text the Address

And Conne is the connection already created.
hope that helps
regards.

jbisono 51 Posting Pro in Training

Hi, I do not really understand what is your goal with this code, first of all this line does not seem right to me.

dim token as integer = 'something'

but anyway i think what you want is this.

Dim token As Integer = 3
        Dim Array1(,) As Integer = {{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}}
       
        For i As Integer = 0 To 1
            For a As Integer = 0 To 4
                If Array1(i, a) = token Then
                    TextBox1.Text += "Should Find Number 3 two times"
                End If
            Next a
        Next i

Regards

jbisono 51 Posting Pro in Training

Try this

Select a.SubCat_Name from SubCategory as a inner join category as b on a.SubCat_Cat_id = b.Cat_id
where b.Cat_name = '" & DirectCast(e.Item.FindControl("chkCategory"), CheckBox).Text & "'

I do not know if your really need DirectCast cause you are just asking for the checkbox label text which is string.

regards.

jbisono 51 Posting Pro in Training

ok, i do not know if this is the best solution but it work.

I test this try to replace your statement in values, notice the event OnItemDataBound that makes the trick.
aspx

<table>
        <asp:DataList ID="DataList1" runat="server" OnItemDataBound="bounditem">
        
        <ItemTemplate>
        <tr><td>
            <asp:CheckBox ID="chkCategory" runat="server" Text='<% #DataBinder.Eval(Container.DataItem, "OPTION_FNCTN").ToString() %>' /></td><td>
            <asp:CheckBoxList ID="ckhSubCategory" runat="server"></asp:CheckBoxList></td></tr>
        </ItemTemplate>
      
        </asp:DataList>
        </table>

Now in the onload page i just generate the first checkbox which is the category one. notice in the select statement the function DISTINCT.

protected void Page_Load(object sender, EventArgs e)
        {
            string st = "SELECT distinct OPTION_FNCTN FROM MENUOPTS_T WHERE (OPTION_FNCTN <> '') ORDER BY OPTION_FNCTN";
            DataSet ds = new DataSet();
            SqlDataAdapter adap = new SqlDataAdapter(st, MyConn);
            MyConn.Open();
            adap.Fill(ds);
            MyConn.Close();
            DataList1.DataSource = ds;
            DataList1.DataBind();
        }

now i create another function while the datalist is bounded this is the function.

protected void bounditem(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string stGet = "SELECT OPTION_DESC FROM MENUOPTS_T WHERE (OPTION_FNCTN = '"+((CheckBox)e.Item.FindControl("chkCategory")).Text+"')";
                DataSet dsGet = new DataSet();
                SqlDataAdapter adapGet = new SqlDataAdapter(stGet, MyConn);
                MyConn.Open();
                adapGet.Fill(dsGet);
                MyConn.Close();
                ((CheckBoxList)e.Item.FindControl("chkSubCategory")).DataSource = dsGet;
                ((CheckBoxList)e.Item.FindControl("chkSubCategory")).DataTextField = "OPTION_DESC";
                ((CheckBoxList)e.Item.FindControl("chkSubCategory")).DataValueField = "OPTION_DESC";
                ((CheckBoxList)e.Item.FindControl("chkSubCategory")).DataBind();
            }
        }

i bet you there are a few ways to do this but, this is the first one that comes to my mind.

Regards

jbisono 51 Posting Pro in Training

well i can tell you right now why.

you are retreiving category and sub category and the same resultset and your data is show as example.
Category Sub_Categor
Network CCNA
Network CCNP
Programming C#
Programming VB

and when you pass that to the datalist is going to embed the data as show above. and what you need is
Network CCNA
CCNP
Programming C#
VB
now are you doing that because somebody can select multiple sub_category at the same time?

jbisono 51 Posting Pro in Training

I would say this

<td><asp:Checkbox ID ="cat_title_chk" AutoPostBack="true" runat="server" OnCheckedChanged="CheckChange" Text='<%# Container.DataItem("M_CATPAGES_CAT") %>'></asp:Checkbox> </td> 
<td><asp:Checkbox ID ="chkSecond"  runat="server"  Text="Second CheckBox" Visible="False"></asp:Checkbox> </td>

Now in the source code i have this.

protected void CheckChange(object sender, EventArgs e)
        {
            CheckBox chk = ((CheckBox)sender);
            DataListItem dlItem = ((DataListItem)chk.NamingContainer);
            if (chk.Checked)
            {
                ((CheckBox)title_dl.Items[dlItem.ItemIndex].FindControl("chkSecond")).Visible = true;
            }
        }

I hope that work for you regards.

jbisono 51 Posting Pro in Training

you are doing good, after that save the content of the word document into a string variable in then read word by word the content.

String ContentWord = "";
ContentWord = data.GetData(DataFormats.Text).ToString();
jbisono 51 Posting Pro in Training

Hi, I just take a quick view to your code and I notice that your select statement have a " , " extra

SELECT memberpersonal.name,memberpersonal.memberid, FROM

I make it bold, Take it out.

regards.

jbisono 51 Posting Pro in Training

I believe there is some!!! but in my opinion the main one is performance.

jbisono 51 Posting Pro in Training

Why do you want to do that? anyway you can do this

using System.Text.RegularExpressions;

   str="";
   int no;
   Regex rxNums = new Regex(@"^\d+$"); // Any positive decimal
   if (rxNums.IsMatch(str))
      {
          no = Convert.ToInt32(str);
      }

Regards.

jbisono 51 Posting Pro in Training

Hi,
This code going into the dropdown event change, i think you are using 2003, im sorry i cant test this code in that version but in 2005 it work, hope that work for you.

string strJS = "";
        strJS = "newwindow2 = window.open('URL','MyWindow','menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,width=300,height=200');"; 
        strJS += "newwindow2.focus();";
        ScriptManager.RegisterStartupScript(this, GetType(), "alert", strJS, true);

Regards.

jbisono 51 Posting Pro in Training

I do not really understand your point. because if you want to edit something and that is why you have a edit button, the row you working with should become textbox in order to edit something.

jbisono 51 Posting Pro in Training

Hi, I do not see the problem with this

<textarea rows="10" cols="50">
</textarea>

regards.

jbisono 51 Posting Pro in Training

hi,

you need to set the MaintainScrollPositionOnPostBack in the aspx page <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" [B]MaintainScrollPositionOnPostback="true"[/B] %> That is in vs 2005. in vs2003 i think is SmartNavigation="true"

Regards

jbisono 51 Posting Pro in Training

Could be a lot of reasons but, ones i had that problem with mine computer and i fixed it with this tool http://windowsxp.mvps.org/peboot.htm, hope that help you

Regards.

jbisono 51 Posting Pro in Training

I think the best way to go is ddambe's way, or doing everything in one spot. this is c#, vb is similiar. TextBox3.Text = Convert.ToString(Convert.ToDouble(TextBox1.Text) * Convert.ToDouble(TextBox2.Text));

jbisono 51 Posting Pro in Training

Hey Veena I finally get this to work this is the code.

dim rsVen
dim dbCon
dim sCon
dim sSql
dim nVNBR
Dim Temp

set dbCon = CreateObject("ADODB.Connection")
set rsVen = CreateObject("ADODB.Recordset")
sCon = "driver={SQL Server};server=;uid=;pwd=;database=;"
dbCon.ConnectionString = sCon
dbCon.Open()
'Bits is the binary field
sSql = "SELECT PURC_ORDER_ID, TYPE, BITS, BITS_LENGTH FROM PURC_ORDER_BINARY WHERE PURC_ORDER_ID = '290590'"

rsVen.Open sSql, dbCon, 1, 3
rsVen.AddNew

'this is the piece of string i want to save
nVNBR = "Hi how are yodsf sd"

Set Temp = rsVen("BITS")

rsVen.Fields("BITS_LENGTH").Value = 25
Temp.AppendChunk (StringToMB(nVNBR) & ChrB(0)) 
rsVen("PURC_ORDER_ID").Value = "290590"
rsVen.Fields("TYPE").Value = "D"

rsVen.Update
dbCon.Close()

Function StringToMB(S)
  Dim I, B
  For I = 1 To Len(S)
    B = B & ChrB(Asc(Mid(S, I, 1)))
  Next
  StringToMB = B
End Function

Thanks for all your help.

jbisono 51 Posting Pro in Training

Thanks again Veena for your time.

Now when I Declare the variables like this
Dim nVNBR As String, it give me back an error saying this
'Expected end of statement', I research what is the solution for this in microsoft website and just says this "To correct this error Remove the extra text. "

any other suggestion?

jbisono 51 Posting Pro in Training

Hi,
First, Have you tried to reset your router and your modem.
Second, Try to enable security on your router so no one else and your neighborhood can get internet threw.
Third, Check your speed connection and this site http://www.speedtest.net/

Hope that helps.

Regards.

jbisono 51 Posting Pro in Training

i do this to get the current computer maybe look for something like this. Dim IPAddress as String = Request.ServerVariables.Get("REMOTE_ADDR") that is vb, c# is almost the same.

jbisono 51 Posting Pro in Training

Hi,
you saying that you can get into the multiboot selection, but you actually select the hard drive or even the cd at the time you try with the win xp recovery?

if that does not work try to go into F2 setup and check the available drive, make sure the hard drive and the cd rom is list, if that is ok then check the boot sequence in the bios.

if mention above is ok, and still does not work try to remove the RAM and put them back.

I hope this help you.

Regards.

jbisono 51 Posting Pro in Training

I am sorry but i think you need to redesign your database in that case i would have 3 tables like this,
First one "Student" with all the personal Info.
Second One "Course" with al Course available
and third a table call something like StudentInCourse which going to have the primary key from the student table and the primary key from the course.

I do not know if that is what you are looking for, but if my idea does not sound right to you i can help your with yours anyway.

Regards

jbisono 51 Posting Pro in Training

I do not really understand your question, First you want to add student to the database, i think you have a little form with the personal information and what course from a list box. and then you want to search into the database base on the course selected is that the point?

jbisono 51 Posting Pro in Training

Hi,

Well, If your field is Binary, then you need to use AppendChunk..
Just One more correction, After opening the Recordset, you need to write this line :

rsVEN.Open sSql, dbCon, 1, 3
rsVen.AddNew

(Rest of the Code Remains same..)

Regards
Veena

Thanks Veena I really appreciate your help i did what you said, but still the statement is saving the first character of the string. Check the code how looks like now.

dim rsVen
dim dbCon
dim sCon
dim sSql
dim nVNBR
Dim BytArray(19)
Dim Temp
Dim ByteIndex 
set dbCon = CreateObject("ADODB.Connection")
set rsVEN = CreateObject("ADODB.Recordset")
sCon = "driver={SQL Server};server=;uid=;pwd=;database=;"
dbCon.ConnectionString = sCon
dbCon.Open()
'Bits is the binary field
sSql = "SELECT PURC_ORDER_ID, TYPE, BITS, BITS_LENGTH FROM PURC_ORDER_BINARY"
rsVEN.Open sSql, dbCon, 1, 3
rsVen.AddNew
'this is the piece of string i want to save
nVNBR = "bi how are yodsf sd"

For ByteIndex = 1 To 18
rsVen("BITS").AppendChunk(MID(nVNBR,ByteIndex,1))
Next

rsVen("PURC_ORDER_ID").Value = "290590"
rsVen.Fields("TYPE").Value = "D"
rsVen.Fields("BITS_LENGTH").Value = 19

rsVen.Update
dbCon.Close()
jbisono 51 Posting Pro in Training

Hi,
I do not know if this can help but try it
replace dr(0) for dr.GetString(0) and dr.GetString(1).
also try in the select retrieve exact the two fields that you want, i do not know what is the structure of your table. if that does not work try this

Dim cmd As New OleDbCommand("select * from login where id= '"+txtUser.Text+"' and pass='"+txtPwd.Text+"'", conn)
        dr = cmd.ExecuteReader
        if(dr.HasRows)
            Form2.Show()
        Else
            txtUser.Clear()
            txtPwd.Clear()
            txtUser.Focus()
        End If
jbisono 51 Posting Pro in Training

Can you show the insert statement specially the way you are passing those values.

Regards

jbisono 51 Posting Pro in Training

Hi jbisono,

Thanks for ur reply, but sorry to say i even tried this and it didn't work. Lets say the date that i get is in the format M/d/yyyy, and the date is 5/5/2008.. the method u mentioned works fine and it converts the date to dd/mm/yyyy. But if the date is 5/14/2008, then it shows the error as the value for date is not correct. This is where i am stuck.

Yes because when you say 5/14/2008, the code assume 14 as month and there is not 14 month so change the dd/mm/yyyy to MM/dd/yyyy it should work.

regards

jbisono 51 Posting Pro in Training

Oh well sorry to hear that, Lets keep try.

String MyString;
 MyString = "1999-09-01 21:34 PM";
 //MyString = "1999-09-01 21:34 p.m.";  //Depends on your regional settings

 DateTime MyDateTime;
 MyDateTime = new DateTime();
 MyDateTime = DateTime.ParseExact(MyString, "dd/MM/yyyy",null);
jbisono 51 Posting Pro in Training

Hi try this

string email = "Your@email.com";
MailMessage message = new MailMessage();
message.From = new MailAddress(email);
message.To.Add("recipient@email.com");
message.Subject = "Subject";
message.Body = "Body";
SmtpClient emailClient = new SmtpClient("SmtpServer");
emailClient.Send(message);

note that SmtpServer could be a real Smtp Server or 127.0.0.1 or "LocalHost"

hope that work

jbisono 51 Posting Pro in Training

is your site online? post your link. Check out new modules that you have added recently, try to disable the new ones and see what happen.

regards

jbisono 51 Posting Pro in Training

well as far i know you cannot call the .swf from your css, the .swf file have to be embed right into the html file or aspx file. go to this link to know how to do that http://www.w3schools.com/flash/flash_inhtml.asp

lets say that your have a div tag in your html that containt the header

<div id="header">
<object width="550" height="400">
<param name="movie" value="somefilename.swf">
<embed src="path to your .swf file" width="550" height="400">
</embed>
</object>
</div>
jbisono 51 Posting Pro in Training

try this

select ( select f.cycle as col1
	from final as f
	for xml raw, elements, type).query('for $col1 in (row/col1) return concat($col1, " ")')

I did not test this.

Regards.

jbisono 51 Posting Pro in Training

I did not test this, but I think you can use this
DateTime dt;
dt = Convert.ToDateTime("5/20/2008");

I am assuming your are in C#. VB is basically the same thing

hope it works regards

jbisono 51 Posting Pro in Training

Thanks Veena for your response.

If i do the same you are saying it give me back this error "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.' At Line 24 Position 0" in Line 24 i have this piece of code rsVen("BITS") =nVNBR.

in the other hand the BITS field in the database is type binary, blob that is why i was using AppendChunk.

Thanks again.

jbisono 51 Posting Pro in Training

Try this have worked for me couple of times
Reboot on Safe Mode with network options.
Delete your Malwarebyte shortcut from your desktop.
Go to your program files C:\Program Files\Malwarebytes' Anti-Malware and change the name of mbam.exe to something else but not similar to others antivirus programs, and now try to run malwarebytes, it should work.

jbisono 51 Posting Pro in Training

Hi, Im new here, im sorry if i am posting in a wrong forum, i have a piece of code that update a binary field in sql server 2000, im keeping this code a simple as possible, so this is working but only save the first character in the string in this case the letter H i want to save the hole string what i am missing thanks.

im rsVen
dim dbCon
dim sCon
dim sSql
dim nVNBR
Dim BytArray(19)
Dim ByteIndex
set dbCon = CreateObject("ADODB.Connection")
set rsVEN = CreateObject("ADODB.Recordset")
sCon = "driver={SQL Server};server=;uid=;pwd=;database=;"
dbCon.ConnectionString = sCon
dbCon.Open()
'Bits is the binary field
sSql = "SELECT BITS, BITS_LENGTH FROM PURC_ORDER_BINARY WHERE PURC_ORDER_ID = '290585'"
rsVEN.Open sSql, dbCon, 1, 3, 1
'this is the piece of string i want to save
nVNBR = "hi how are yodsf sdf"

For ByteIndex = 1 To 18
rsVen("BITS").AppendChunk MID(nVNBR,ByteIndex,1)
Next

rsVen.Fields("BITS_LENGTH").Value = 19

rsVen.Update
dbCon.Close()