M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes you can use binding navigator for this purpose.add same datasource you assign to grid to binding navigator.it will navigate your records.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

are they textboxes ? GUIREP_drop.Search.Text , or something else

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please explain your prob , so that i can help you

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please check the datatype of this field in your db .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
here is an error

Case "Student ID"
      strsql = "{drop_student.Dropstud_no} = " & GUIREP_drop.search_student.Text.ToString & ""
'because student_id or student no is numeric vlaue , and you are using tostring . use this code 
            Case "Student ID"
                strsql = "{drop_student.Dropstud_no} = " & val(GUIREP_drop.search_student.Text)

Hope this will solve your prob :) .if yes please vote me up and mark your thread solved :)

Best Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i am working on a single page of asp ,and i am using ext js 4.0 with it . i have a grid of extjs , my task is to show records in that grid from mssql server 2008 , for getting records i am using webservice . code for webservice is this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Services;
using System.IO;
using System.Text;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using System.Runtime.Serialization;
namespace JSWorking
{
    /// <summary>
    /// Summary description for WebService2
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WebService2 : System.Web.Services.WebService
    {
        HttpContext postedContext = HttpContext.Current;
        [WebMethod (EnableSession = true )]
        [ScriptMethod (ResponseFormat = ResponseFormat .Json ,UseHttpGet = true ,XmlSerializeString = false )]
        public List <Object[]> GetData ( string Name , int PhoneNo , int CellNo , int IDNo , string Advance )
        {
            string strCN = "Data Source=waqas\\sqlexpress2;Initial Catalog=myDB;User Id=waqas;Password=patanahi;";
            SqlConnection CN = new SqlConnection(strCN);
            CN.Open();
            string strQuery = "Select Name,PhonenO,CellNo,IDNo,Advance from Students";
            SqlCommand cmd = new SqlCommand(strQuery,CN);
            cmd.CommandType = CommandType.Text;
            SqlDataReader reader = cmd.ExecuteReader();
            List<Object[]> myArray = new List<object[]>();
            try
            {
                while (reader.Read())
                {
                    Object[] values = new Object[reader.FieldCount];
                    int fieldCount = reader.GetValues(values);
                    myArray.Add(values);

                }
                return myArray;
            }
            catch (Exception ex)
            {
            throw ex;  

            }
            finally 
            {
            reader.Close ();
                reader.Dispose ();
                cmd.Dispose ();
                CN.Close ();
                CN.Dispose ();
            }
            } …
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

then please mark this thread solved . Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

look where you type comments , there is a link to mark this thread solved . click it , and the thread will be mark as solved.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
please change given code , may be this time it work fine

' roomprice = CInt(roomcost.Text) 
  roomprice = val(roomcost.Text)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Im able to view Data from the EmployeeID I enter but its not filtering my second textbox.Its displaying all data from Employee.What am I doing wrong?

hello !
please check this post carefully ,

mystr = "{tablename.EmployeeID} = " & val(textboxA.text) & "  and {tablename.PayrollNumber} = '" & textboxB.text &"'"
'first check you database fields data type , if your field datatype is int , bigint , decimal etc then always use val(your textbox or variable ) and if datatype is string , char , or varchar , then always use 'your textbox or variable' , now you should have these things in your mind before coding.

Hope next time your prob will be different not regarding with datatype .
if this post solve your prob and useful for you , please vote me up .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Get this error

Conversion from string "INSERT INTO CAGETYPE(CAGECOST,"to type 'Integer' is not valid.

hello !
please try this code ,

Dim sql As String = "INSERT INTO CAGETYPE (CAGECOST, CAGENAME) VALUES(" & val(roomprice) & ",'" & roomtitle & "')"

hope this will solve your prob , if yes then please mark your thread solved and vote me up :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

well if you are getting this error then little bit change your code like this

mystr = "{tablename.EmployeeID} = " & val(textboxA.text) & "  and {tablename.PayrollNumber} = " & val(textboxB.text)

hope this will help you , and please post your code after getting some error so that any one can better help you.

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

sorry but i cant get your point . please rephrase your question .
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

try this code :)

If ListBox1.Items.Count = 0 Then

        Else

        End If
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please explain what you want to do , if you have any prob regarding with sql then please post your question in sql forum .
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please mark this thread solved :)

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

then please check you id and password again at www.gmail.com. because there is nothing wrong with that code .

vivekanandaan commented: spontaneous help ..... +2
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hmmmm , ok do you import these classes ?

Imports System.Web
Imports System.IO
Imports System.Net.Mail
Imports System.Net.Mail.Attachment
Imports System.Runtime
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

if you are using vb 6 then please post your question in vb 6 forum to get good solutions of your prob.

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please post your code here so that i can check it , because it is working at my end .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

ok but you want to show just surname middlename and firstname in your report , if yes , then please group on surname middlename and firstname .then in your report only one record will show . and if you are using query and generating your report programmetically then use group by clause in your query .

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

check this out

Dim i As Integer
        Dim a As Integer
        Dim isfound As Boolean
        For i = 0 To DataGridView1.Rows.Count - 1
            a = Val(ListBox1.Items(i))
            a = DataGridView1.Item("columnindex", i).Value.ToString '
            If txtSearch.Text = a Then
                isfound = True
                Exit For
            Else
                isfound = False
            End If
        Next
        If isfound = True Then
            MsgBox("found")
        Else
            MsgBox("not found")
        End If

if this code helps you and solve your prob ,please mark your thread solved and vote me up :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
you are getting records from db , and then want to search records from the grid ? can you please rephrase it

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

please use gmail id to send emails :)

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
use this code

If MsgBox("r u sure ", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            'your form closing code
        End If

Hope this will help you ,if yes please vote me up :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

surname 1 firstname1 middlename1
surname 1 firstname1 middlename1
surname 1 firstname1 middlename1
surname 1 firstname1 middlename1
surname 1 firstname1 middlename1
all these fields having same data ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
you can do it like in this way

Dim total As Int32
        Dim i As Integer
        For i = 0 To ListBox1.Items.Count - 1
            total = total + Val(ListBox1.Items(i))
        Next
        txttotal.Text = total

hope this will solve you prob , if yes then vote me up :P
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
check this out

'first import these classes
Imports System.Web
Imports System.IO
Imports System.Net.Mail
Imports System.Net.Mail.Attachment
Imports System.Runtime
'now use this code to send emails with attachments

    Sub mail()
        On Error Resume Next
        Dim mail As New MailMessage()
        Dim SmtpServer As New SmtpClient
        SmtpServer.Credentials = New Net.NetworkCredential("YourEmail ID", "Password")
        SmtpServer.Port = 587
        SmtpServer.Host = "smtp.gmail.com"
        SmtpServer.EnableSsl = True
        SmtpServer.EnableSsl = True
        mail.To.Add("id on which u want to receive email")
        mail.From = New MailAddress("id which send email")
        mail.Subject = Me.txtsubject.Text
        mail.Body = txtbody.Text
        Dim myfile As New Attachment(Me.txtfileaddress.Text)'here you have to give the path of attached file.
        mail.Attachments.Add(myfile)
        SmtpServer.Send(mail)
        MsgBox("Email Send SuccessFully. :)", MsgBoxStyle.Information)
    End Sub

if this code helps you :) please vote me up

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i think you want to show the related records of given code in textbox in combo and then if you change the value of combo then want to show the related code in textbox, am i right ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

yes you are right in my code you can just show single field from database .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

you want to show msgbox with the selected data of combo by clicking on the button ? if this is what you want then you can do like this

msgbox(combobox.text)

or if this is not what you want please rephrase you question:)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
if you want to insert data from vb.net form to your mssql database then this code will help you

dim mycon as new sqlconnection("connectionstring")
mycon.open()
dim cmd as new sqlcommand
cmd.connection=mycon
cmd.commandtext="insert into table (field1,field2) values (@field1,@field2)"
cmd.parameters.addwithvalue("@field1",txtField1.text)
cmd.parameters.addwithvalue("@field2",txtField2.text)
cmd.executenonquery()
mycon.close()

Hope this will helps you :)
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
you can do this in this way also .

dim mycon as new sqlconnection("connectionstring")
mycon.open()
dim da as new sqldataadapter("select * from table1",mycon)
dim dt as datatable
da.fill(dt)
combobox1.datasource = dt
combobox.displaymember = "field name you want to show "
combobox.valuemember  ="field name you want to get as a value "
mycon.close

Hope this will helps you
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
use this code before this CrystalReportViewer1.ReportSource = cryRpt

With crConnectionInfo
            .ServerName = "YOUR SERVER NAME"
            .DatabaseName = "YOUR DATABASE NAME"
            .UserID = "YOUR DATABASE USERNAME"
            .Password = "YOUR DATABASE PASSWORD"
        End With

i hope this will solve your prob :)
Please if your prob is solved the mark this thread solved and vote me up :)
Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

what :o , how ? it gives any error ? , it is 100% working at my end , and i also attach that solution :(

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
Please check the attached solution , it will ban single user for 10 mints ,

ryklon commented: Helped me out. +1
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
check this code and also the attached solution :) hope this time it works fine .

Dim mycon As New SqlConnection("Data Source=pakistan\sqlexpress;Initial Catalog=testing;Integrated Security=SSPI;")
        mycon.Open()
        Dim cmd As String
        cmd = "select * from product where pid=" & Val(TextBox1.Text)
        Dim da As New SqlDataAdapter(cmd, mycon)
        Dim dt As New DataTable
        da.Fill(dt)
        If dt.Rows.Count = 0 Then
            MsgBox("no records found.")
        End If
        DataGridView1.DataSource = dt
        mycon.Close()

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

:P please first check your msgbox text then change the ">" to "<" :P its my mistake sorry :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

ohh ok ok . well do like this :)

Dim con As New OleDbConnection("Connection String")
      Dim cmd As OleDbCommand = New OleDbCommand("select * from table1 where StaffID='"&txtStaffID.text&"'", con)
        con.Open()
        Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        Dim myDataSet As DataSet = New DataSet()
        myDA.Fill(myDataSet, "MyTable")
'take a bindingsource from the tool box then
bindingsource.datasource = myDataSet.Tables("MyTable")
if bindingsource.count > 0 then
msgbox("no record found")
else
  dgvTableList.DataSource = myDataSet.Tables("MyTable").DefaultView
end if 
        con.Close()

hope this time it works fine , :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
you have to make the login in server for this client then connect it ,

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
you have to use group on author name ,now there are two possible ways to perform this action ,1-use crystal report groups for this (i not recommend it) and no 2nd is try to use view and in your view group on author name .you want to show your report in this way ?

authorname
  1-book title   addeddate
  1-book title   addeddate
  1-book title   addeddate
  1-book title   addeddate
  1-book title   addeddate
authorname
  1-book title   addeddate
  1-book title   addeddate
  1-book title   addeddate
  1-book title   addeddate

if yes then you have to use crystal report group function .
or if you want to show your records like this

authorname addeddate totalbooks
authorname addeddate totalbooks
authorname addeddate totalbooks
authorname addeddate totalbooks

then it is better to use the view .

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
here is an error in your code

cmd.Parameters.AddWithValue("@p1", FirstName)'---error
cmd.Parameters.AddWithValue("@p2", LastName)'---error
cmd.Parameters.AddWithValue("@p3", Address)'---error
'==================================================
'check this code
cmd.Parameters.AddWithValue("@p1", txtFirstName.text)
cmd.Parameters.AddWithValue("@p2", txtLastName.text)
cmd.Parameters.AddWithValue("@p3", txtAddress.text)

Hope this will work fine :)
if your prob is solved please mark this thread solved and vote me up :)

Regards

kingsonprisonic commented: For wrong suggestion ..... -1
thehunk commented: this is for his efforts , mistake is a part of programming +0
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello!
check this code may be this helps you

Dim con As New OleDbConnection("Connection String")
      Dim cmd As OleDbCommand = New OleDbCommand("select * from table1 where StaffID='"&txtStaffID.text&"'", con)
        con.Open()
        Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        Dim myDataSet As DataSet = New DataSet()
        myDA.Fill(myDataSet, "MyTable")
        dgvTableList.DataSource = myDataSet.Tables("MyTable").DefaultView
        con.Close()
'this code will populate all the records of given id , now the most imp thing is 
'WRITE THIS CODE ON THE TEXTCHANGE EVENT OF THE TEXTBOX NAME TXTSTAFFID.

hope this will helps you , if your prob is solved then please mark this thread solved and vote me up :)

Regards

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

There is not a specific reason for it. This is just for the sake of knowledge
As this came in my mind while discussing with my colleagues in office.
Thanks all of you for showing interest...

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

can you please your required unique schedule format .?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
if you are using db with this application then make a table for example name tblLogingFail .now when ever you want to ban a user then insert data in that table fields name recID,UserID,Logindate , now after this set condition that if logintime difference is less then 10 min then dont allow user and if difference is more then 10 mint allow him to login.

Regards

ryklon commented: Thanks for gaving me hints. +1
M.Waqas Aslam 67 Posting Pro in Training Featured Poster

Publish means that you want to build your project .exe ?

M.Waqas Aslam 67 Posting Pro in Training Featured Poster

hello !
i want to know if there is any programming language to develop desktop applications which can not be decomplie any way .as i am currently working in .net , and it is very easy to decompile .net code . is there is any other language which is safe from decompiling .(sorry for my bad english.)

Regards

M.Waqas Aslam