15,891,938 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by atul sharma 5126 (Top 121 by date)
atul sharma 5126
2-Jun-18 2:55am
View
M glad to unknowingly bring smile to some very intelligent souls.
atul sharma 5126
2-Jun-18 2:53am
View
Thanks a lot for your time and efforts for explaining the matter. It is indeed only happening in production, and that too if I am directly pasting the files to the website folder. If i use web deploy tool from iis and deploy the zip file generated from VS, then the issue does not arise.
Any link if you can provide to know more about logging statements will be of great help.
Thanks.
atul sharma 5126
23-Dec-15 21:59pm
View
Thanks for the reply!
I have checked and the path is correct. Infact filefullname.fullname and thefilename are same.
Also code is working fine when pkg run from VS but when hosted, the file is not deleted.
atul sharma 5126
2-Sep-15 8:51am
View
Thanks for the reply dear !
But as mentioned earlier, I am exporting a panel with already filled multiple tables, grid view etc. And so want to keep the format designed in aspx intact and cannot design whole page from scrach.
Pls suggest !
Thanks
atul sharma 5126
6-Aug-15 5:43am
View
A very wise suggestion. Thanks !
atul sharma 5126
25-Jul-15 9:17am
View
To update for use by anybody. The above solution was working well in development but was giving error when made live. The solution worked was ../../AppPages..
atul sharma 5126
21-Jul-15 6:37am
View
Thanks dear it worked smoothly by "/AppPages/frmEmailPopUp.aspx"
atul sharma 5126
30-Jun-15 5:43am
View
I could not find any code to export/save the aspx page in pdf. The code given above just writes plain string in pdf when what I require is to export my already created page.
Hope I am able to clearly mention my situation.
Thanks
atul sharma 5126
29-Jun-15 1:30am
View
Absolutely right. for this reason itself I want to save the already created aspx page as a whole.
atul sharma 5126
29-Jun-15 1:29am
View
I agree to your suggestion and I have same thing for final code. but for now my focus was to automatically save the whole page at a pre-decided location
atul sharma 5126
29-Jun-15 1:16am
View
Thanks for the reply dear.
I was able to save the whole page with following code but facing two issues:
1. It asks for whether I want to open or save the page when I would like the page to automatically be saved.
2. The page is saved in landscape format when it should be saved in potrait A4 ready to print format.
Pls suggest.
Thanks again..
Response.ClearHeaders()
Response.Clear()
'this clears the Response of any headers or previous output
Response.Buffer = True
'make sure that the entire output is rendered simultaneously
Response.ContentType = "application/msword"
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".doc")
atul sharma 5126
16-Jun-15 1:33am
View
If you also want to remove preceding zeroes as well then pls use this updated function:
Public Function fnNumberwithoutzero(ByRef Value As String)
fnNumberwithoutzero = 0
Dim parts() As String = Value.Split("."c)
'for removing preceding zeros
Dim firsthalf As Object = parts(0).ToString.TrimStart("0".ToCharArray)
'for removing trailing zeros
If parts.Length = 2 Then
Dim secondhalf As Object = parts(1).ToString.TrimEnd("0".ToCharArray)
If secondhalf = "" Then
fnNumberwithoutzero = firsthalf
Else
fnNumberwithoutzero = firsthalf & "." & secondhalf
End If
Else
fnNumberwithoutzero = firsthalf
End If
Return fnNumberwithoutzero
End Function
atul sharma 5126
16-Jun-15 1:16am
View
Thanks for your suggestion Mr. Sergey!
Please 1) Try to invest you time in helping
2) And not pulling down the less knowledgeable ones.
atul sharma 5126
14-Jun-15 10:06am
View
I respect your words of experience.
Can you suggest the right code for sending grid view data to excel with caption?
Also, why the same data having interpretation issues 3 out of 6 times?
Please guide..
Thanks!
atul sharma 5126
9-Jun-15 8:32am
View
Thanks dear!
This was one of the reasons.
Others being adding of tcp: before servername instead of \\,
starting of browser service on server, And
stopping of firewall
atul sharma 5126
6-Jun-15 5:53am
View
Thanks for the replies!
@Richard: I have already included the code
@Afzaal: I have tried repeating the code, but the new page opens in the same popup window and not new window
atul sharma 5126
28-Apr-15 0:41am
View
thanks for the reply!
On installing ACE the following message is showing:
You cannot install the 64 bit version of ms Access database engine 2010 because you currently have 32 bit office products installed
atul sharma 5126
3-Apr-15 6:47am
View
Dear All,
Thanks for the replies:
The error shown after removing the try was:
Oledb.12.0 is not registered
I tried solutions as per net but did'nt worked. Now I have noticed that the server OS is 64 bit whereas the excel on server is 32 bit. Can that be the reason?
Thanks again for your concern!
atul sharma 5126
11-Mar-15 2:25am
View
Update:
On restarting the machine the size issue is resolved. The reason still not clear.
So only 1 issue pending now i.e. the background of menu level 2 not chaging when the cursor is on level 3.
atul sharma 5126
11-Mar-15 2:12am
View
Thanks for reply mayank!
I have added the html part. I am using the asp.net menu control and added the items through the right arrow over the control.
Pls check and advise. thanks
atul sharma 5126
27-Feb-15 11:50am
View
Dear John,
I use 2 ddl. ddlToProject and ddlsection.
ddltoProject is populated at page load. following is the code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Call subFromProject()
If dtProjects.Rows.Count > 0 Then
ddlToProject.DataValueField = "PROJC"
ddlToProject.DataTextField = "PROJECT"
ddlToProject.DataSource = dtProjects
ddlToProject.DataBind()
End If
End If
btnShift.Attributes.Add("onclick", "return confirm('Do you want to shift the machine?')")
End Sub
In selected index change event of ddlToProject, the 2nd ddl i.e. ddlsection is populated.
Protected Sub ddlToProject_SelectedIndexChanged(sender As Object, e As EventArgs)
If ddlToProject.SelectedValue <> "" Then
Call subSection()
End If
End Sub
Then I press a shift button for a update command in sql database.
Now, while debugging I found that the ddlsection value is always reaching as the first item in its list, no matter which section I have selected. Hope I am able to explain the issue clearly.
Thanks for support.
atul sharma 5126
27-Feb-15 11:41am
View
thanks for the reply!
I have initially started without the autopostback and tried to make false only for solving this issue.
atul sharma 5126
27-Feb-15 2:33am
View
Thanks a lot. It worked perfectly.
atul sharma 5126
27-Feb-15 1:58am
View
Thanks for your reply dear!
But I have to specify the value of PLPRLC from a parameter based upon a drop down list.
If "All" is selected in the ddl then all records including Null are desired to be shown else only the selected ddl value records are to be shown.
Problem is when All is selected then Null records are not picked up..
atul sharma 5126
27-Feb-15 1:56am
View
Thanks for the reply!
Message: 'IFNULL' is not recognized built-in function name
used is sql server 2012
atul sharma 5126
25-Feb-15 19:20pm
View
Thanks dear. It worked perfectly.
atul sharma 5126
15-Feb-15 12:00pm
View
Thanks a lot Peter. It worked nicely.
One question though. I was not able to use ID$='Date' of common function and instead have to create separate function with id*=txtDispatchDate
Can u pls tell why?
Thanks again
atul sharma 5126
28-Jan-15 8:54am
View
Thanks for the replies.
I have done line by line debugging with view over the output window and found no error.
And yes I have tested the server and connection in same code by adding a normal insert command instead of bulk.
Also to bring to notice that I have an identity field in datatable to which I am not sending any value.
atul sharma 5126
26-Dec-14 4:28am
View
thanks for the reply Abhinav!
Let me re-phrase my query: How do we split the text into multilines bases on character ; .
Thanks
atul sharma 5126
2-Dec-14 4:34am
View
Thanks
atul sharma 5126
23-Nov-14 1:24am
View
Thanks! If this is put in solution I will accept the same
atul sharma 5126
19-Nov-14 12:51pm
View
Thanks all. Problem found. In one table the user has entered single quotes twice and in the other the different user has entered double quotes.
Sorry for incovenience
atul sharma 5126
19-Nov-14 12:37pm
View
Hello Shweta! Sorry but I could not get your query.
They are the two fields on which I have created the Join. and Machine'' is a sample of data in fields.
atul sharma 5126
19-Nov-14 12:30pm
View
Thanks for the reply!
The problem is that StdQty is coming Null when actually their is data in the table.
The possible reason i am sighting is that the BOM.BOMMN is a string= Machine''
Also, when I create a right join, all data from BOM table is shown for field StdQty, hence I cam presume that the field reference is correct and the problem lies somewhere in joining.
atul sharma 5126
26-Oct-14 1:40am
View
monitor is the name of my solution. Are you suggesting to put whole project code here?
atul sharma 5126
26-Oct-14 1:18am
View
I have found dll file in obj folder but its contents are in encrypted form. from where i can copy them. pls suggest..
Thanks
atul sharma 5126
25-Oct-14 13:47pm
View
Private Sub subBacktoManage()
varmode = 4
Session("Mode") = 4
Response.Redirect("Allocation.aspx")
End Sub
I am not clear about the dll contents as I am running the code from visual studio
atul sharma 5126
17-Oct-14 6:29am
View
BANG ON!!!
DirectCast(e.Row.FindControl("ddlJuniors"), DropDownList) was Nothing as ddlJuniors was in Item template and header row did not have it.
Thanks for the support and patience..
atul sharma 5126
17-Oct-14 5:59am
View
I accept your comments with respect. Yes I am new to coding.
But I have used similar code earlier it worked nicely. I have made following changes as per understanding your solution. Pls check and guide. Thanks..
If dtPersons.Rows.Count > 0 Then
dim ddl as dropdownlist = DirectCast(e.Row.FindControl("ddlJuniors"), DropDownList)
**ddl.DataSource = dtPersons
ddl.DataTextField = "USERN"
ddl.DataValueField = "USERID"
ddl.DataBind()
End If
atul sharma 5126
16-Oct-14 7:41am
View
Deleted
I accept your comments with respect. Yes I am new to coding.
But I have used similar code earlier it worked nicely. I have made following changes as per understanding your solution. Pls check and guide. Thanks..
If dtPersons.Rows.Count > 0 Then
dim ddl as dropdownlist = DirectCast(e.Row.FindControl("ddlJuniors"), DropDownList)
**ddl.DataSource = dtPersons
ddl.DataTextField = "USERN"
ddl.DataValueField = "USERID"
ddl.DataBind()
End If
atul sharma 5126
16-Oct-14 0:53am
View
the second error resolved. thanks.
But now stuck with the original error of object reference at:
ddlJuniors.DataSource = dtPersons
atul sharma 5126
15-Oct-14 7:19am
View
You are probably right. After making your suggested changes the error point has changed to:
Dim ddlJuniors As DropDownList = DirectCast(e.Row.FindControl(ddlJuniors.ClientID), DropDownList)
Also highlighed is the ddlJuniors within find control: variable ddljuniors is used before being assigned a value.
atul sharma 5126
5-Oct-14 12:01pm
View
Thanks dear
atul sharma 5126
5-Oct-14 11:37am
View
Dear Wes,
It was confusing because the user has to enter dd-MM-yyyy and the same was not accepted when the pkg is published. Whereas while debugging their was no error. So the conversion command was the issue.
Thanks for the reply.
atul sharma 5126
5-Oct-14 11:34am
View
Both actually. I want to validate before insert command that the text entered in the text box is in correct date format.
atul sharma 5126
5-Oct-14 10:19am
View
You are the lucky mascot for me! thanks a ton
I changed the following and it worked:
Dim varTargetDate As Date = DateTime.ParseExact((txtTargetDate.Text), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)
Please suggest how can I check before submission that the date entered is in correct format??
Thanks again..
atul sharma 5126
17-Sep-14 12:28pm
View
I am using DATETIME format in sql.
I tried changing the format in function to yyyy-MM-dd but that did'nt help.
Should I change the type to DATE instead in sql?
atul sharma 5126
7-Sep-14 11:20am
View
After converting to higher crypto standards the problem with all userids
atul sharma 5126
6-Sep-14 14:57pm
View
done..
the resolveurl command
atul sharma 5126
6-Sep-14 14:30pm
View
dear I am able to run the plugin with internet like in demo but using local file the message of $ is undefined pops up. I have even tried the same files as used online but not helped.
Please suggest..
the code:
in header:
<link rel="stylesheet" href="~/Scripts/jquery-ui-1.11.1.custom/jquery-ui.css"/>
<script src="~/Scripts/jquery-ui-1.11.1.custom/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-ui-1.11.1.custom/jquery-ui.js"></script>
<script>
$(function () {
$("#TextBox1").datepicker();
});
</script>
atul sharma 5126
6-Sep-14 14:17pm
View
I have not found the solution yet.
The process and issue is as follows:
1. I have a public function to convert the password with userid as salt to Hash.
2. At login time I call the hashed field from sql into a datatable DT
3. Entered userid and password by user are converted into Hash using same function as in 1st step.
4.I compare their lengths which match
5. But when i compare their values the 2nd and 3rd value does not match and hence password considered incorrect.
the parameter while saving:
daUser.InsertCommand.Parameters.Add(New SqlParameter("@USERP", fnHashedValue(txtPassword.Text, txtUser.Text)))
the function:
Public Function fnHashedValue(ByVal value, ByVal authentication)
Dim sSourceData As String = value + authentication
Dim tmpSource() As Byte = UTF8Encoding.UTF8.GetBytes(sSourceData)
Dim tmpHash() As Byte = New SHA512CryptoServiceProvider().ComputeHash(tmpSource)
Return tmpHash
End Function
to get saved hash for comparision:
Dim tmpSavedHash() As Byte = UTF8Encoding.UTF8.GetBytes(DT.Rows(0).Item(0))
atul sharma 5126
6-Sep-14 6:59am
View
Thanks
atul sharma 5126
6-Sep-14 5:11am
View
:-) That's an expected question to a newcomer from an expert. I really appreciate your help. Thanks!
atul sharma 5126
6-Sep-14 5:08am
View
Thanks for the info!
atul sharma 5126
4-Sep-14 10:58am
View
I did manage to get identical hash from identical data.
But the problem is not solved because the byte converted from the hashed password taken from database is different then the one created by the function.
atul sharma 5126
4-Sep-14 9:55am
View
Hey SA,
I have modified the code as you suggested with UTF8 and SHA512.
Pls confirm if the following is the right code of conversion of saved password to byte:
Dim tmpSavedHash() As Byte = UTF8Encoding.UTF8.GetBytes(DT.Rows(0).Item(0))
atul sharma 5126
4-Sep-14 9:26am
View
thanks for reply!
I have changed the function to use unicode. and also pasted here is the code i am using for checking the password entered. please check.. as same problem again occuring with every user..
Public Function fnHashedValue(ByVal value, ByVal authentication)
'To Convert string into hash for storing and comparision
Dim sSourceData As String = value + authentication
'Create a byte array from source data.
'Dim tmpSource() As Byte = ASCIIEncoding.ASCII.GetBytes(sSourceData)
Dim tmpSource() As Byte = UnicodeEncoding.Unicode.GetBytes(sSourceData)
'Compute hash based on source data.
Dim tmpHash() As Byte = New SHA1CryptoServiceProvider().ComputeHash(tmpSource)
Return tmpHash
End Function
'To Convert password recoved as string from database to byte for comparision
Dim sha1 As Encoding = Encoding.Unicode
Dim tmpSavedHash() As Byte = sha1.GetBytes(DT.Rows(0).Item(0))
'To convert entered password into hash for comparision
Dim tmpNewHash() As Byte = fnHashedValue(txtPassword.Text, txtUser.Text)
Dim bEqual As Boolean = False
If tmpNewHash.Length = tmpSavedHash.Length Then
Dim i As Integer
Do While (i < tmpNewHash.Length) AndAlso (tmpNewHash(i) = tmpSavedHash(i))
i += 1
Loop
If i = tmpNewHash.Length Then
bEqual = True
End If
End If
atul sharma 5126
18-Aug-14 1:11am
View
Found the solution..
created a link button and in row data bound added the attribute
atul sharma 5126
17-Aug-14 10:23am
View
Dear Wombaticus,
The code which worked for delete button is not working for Grid. Pls suggest. following is the code i am using in page load event of page containing grid in which delete is used as command field. following is the related code:
in html grid columns:
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />
in vb page load:
gdBOM.Attributes.Add("onrowdeleting", "return confirm('Do you want to delete record?')")
'where gdBOM is the name of the grid
Thanks
atul sharma 5126
16-Aug-14 9:37am
View
done!!!
I added the code in page load event and it works..
btnDelete.Attributes.Add("onclick", "return confirm('Do you really want to delete this?')")
Thanks Wombaticus
atul sharma 5126
16-Aug-14 9:29am
View
Thanks for the reply!
You were right in presuming use of Delete button.
I have added the suggested code in click event of button. But it is not working as I believe the delete command is to be enclosed within IF command based upon result of confirm message. But then again how do I get the return value (ok/cancel)?
atul sharma 5126
14-Aug-14 21:52pm
View
Thanks a lot Kschuler. It worked with a little tweaking. The forward slash had to be replaced with backslash:
Menu1.FindItem("Masters").ChildItems.Remove(Menu1.FindItem("Masters/TypeMaster"))
atul sharma 5126
14-Aug-14 7:15am
View
The purpose of this code is to provide rights to users based on their roles. The list of menu will increase by time and the location also modified hence using the location number will be difficult to maintain.
atul sharma 5126
30-Jun-14 1:33am
View
thanks. it worked
atul sharma 5126
30-Jun-14 0:59am
View
Can u pls help to convert this c# code to vb:
GridViewRow clickedRow = ((LinkButton) sender).NamingContainer as GridViewRow;
Label lblID = (Label)clickedRow.FindControl("lblID");
atul sharma 5126
29-Jun-14 12:44pm
View
Tried but not working
atul sharma 5126
8-Jun-14 3:20am
View
Thanks for your reply Nirav. Got solution from digimanus.
atul sharma 5126
8-Jun-14 3:19am
View
Thanks! Earlier I was providing default value to Nothing. Changed it to DBNULL.VALUE.TOSTRING and it worked
atul sharma 5126
26-May-14 3:33am
View
Thanks a lot for your support Damith. It was a typo in control ID of missing 't'
atul sharma 5126
26-May-14 3:33am
View
Thanks a lot Matthew. Small things can make such a big difference.
atul sharma 5126
25-May-14 2:45am
View
ddlNewGridType is a new dropdown list
whereas tbGridTypes has 2 records
atul sharma 5126
25-May-14 2:31am
View
New error removed. But now stuck on the original error
atul sharma 5126
25-May-14 1:52am
View
Thanks for the reply!
Following error showing: 'DropDownList' is as type and cannot be as an expression
atul sharma 5126
25-May-14 1:45am
View
Thanks. It worked partially in reverse way.
The data started saving when binding is done if NOT POSTBACK. But now the data is not displayed on selected index changed event as it also comes under postback.
Any suggestions
atul sharma 5126
24-May-14 22:11pm
View
Can the error be related to the other fields which i have not called and also not used directly but may me checked as the event is RowBound event?
atul sharma 5126
24-May-14 22:08pm
View
Thanks for replying Wes.
I have already tried debugging and mentioned the results within the question.
The error generates on the linking of datasource to dropdownlist (marked with ***)
And i have checked that at the time of linking, datatable has 2 records i.e. it is not Null.
atul sharma 5126
23-May-14 5:09am
View
It worked. Thanks a lot
atul sharma 5126
23-May-14 4:43am
View
Deleted
<asp:GridView ID="DataGridView1"
runat="server"
AutoGenerateColumns="false"
DataKeyNames="BOMIC"
showfooter="true"
enablesorting="true"
CssClass="Grid"
AllowSorting="True"
BorderStyle="Groove"
onrowcancellingedit="datagridview1_rowcancellingedit"
onrowdatabound="DataGridView1_RowDataBound"
onrowediting="DataGridView1_RowEditing"
onrowupdating="DataGridView1_RowUpdating"
onrowcommand="DataGridview1_Rowcommand"
onrowdeleting="DataGridView1_RowDeleting"
onselectedindexchanged="DataGridView1_SelectedIndexChanged"
>
<HeaderStyle CssClass="GridHeader" />
<rowstyle cssclass="GridItem">
<alternatingrowstyle cssclass="GridAltItem">
<columns> <asp:TemplateField HeaderText="Item Code" HeaderStyle-HorizontalAlign="Left">
<edititemtemplate>
<asp:Label ID="BOMIC" runat="server" Text='<%# Bind("BOMIC")%>'>
<itemtemplate>
<asp:Label ID="BOMIC" runat="server" Text='<%# Bind("BOMIC") %>'>
<asp:TemplateField HeaderText="Description" HeaderStyle-HorizontalAlign="Center">
<edititemtemplate>
<asp:Label ID="BOMIN" runat="server" Text='<%# Bind("BOMIN")%>'>
<itemtemplate>
<asp:Label ID="BOMIN" runat="server" Text='<%# Bind("BOMIN") %>'>
<asp:TemplateField HeaderText="Qty" HeaderStyle-HorizontalAlign="Center">
<edititemtemplate>
<asp:Label ID="BOMIQ" runat="server" Text='<%# Bind("BOMIQ")%>'>
<itemtemplate>
<asp:Label ID="BOMIQ" runat="server" Text='<%# Bind("BOMIQ")%>'>
<asp:TemplateField HeaderText="Vendor" HeaderStyle-HorizontalAlign="Center">
<edititemtemplate>
<asp:Label ID="BOMIV" runat="server" Text='<%# Bind("BOMIV")%>'>
<itemtemplate>
<asp:Label ID="BOMIV" runat="server" Text='<%# Bind("BOMIV")%>'>
<asp:TemplateField HeaderText="Page No." HeaderStyle-HorizontalAlign="Center">
<edititemtemplate>
<asp:Label ID="BOMIRM" runat="server" Text='<%# Bind("BOMIRM")%>'>
<itemtemplate>
<asp:Label ID="BOMIRM" runat="server" Text='<%# Bind("BOMIRM")%>'>
<asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
<edititemtemplate>
<asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update">
<asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel">
<footertemplate>
<asp:LinkButton ID="lnkAdd" runat="server" CausesValidation="False" CommandName="Insert" Text="Insert">
<itemtemplate>
<asp:LinkButton ID="lnkEd
atul sharma 5126
29-Apr-14 2:13am
View
thanks Maciej.
Could u pls confirm if my question was downvoted by your goodself. And if yes, then the reason please.
atul sharma 5126
29-Apr-14 0:48am
View
Its indeed a good option.
But in current case the document number is not the primary field but is unique in combination of 2 other fields. Also, I am using multiple forms for data in same table with different starting number. i.e. for one form the number starts from 1100001 and for another 1200001 which is stored in the same datatable and is used afterwards for combined and segregated analysis
atul sharma 5126
28-Apr-14 7:46am
View
I am not clear about the identity field.
Are you suggesting that at the time of saving i should check and create the document number?
atul sharma 5126
9-Apr-14 13:46pm
View
Deleted
I tried to encrypt through help from microsoft site. but error showing of bad data.
Public Class Form1
Private Sub btnEncrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEncrypt.Click
Dim text As Byte() = System.Text.Encoding.Unicode.GetBytes("string")
Dim Exponent As Byte() = System.Text.Encoding.Unicode.GetBytes("password")
'Create values to store encrypted symmetric keys.
Dim EncryptedSymmetricKey() As Byte
'Create a new instance of the RSACryptoServiceProvider class.
Dim RSA As RSACryptoServiceProvider = New RSACryptoServiceProvider()
'Create a new instance of the RSAParameters structure.
Dim RSAKeyInfo As New RSAParameters()
'Set RSAKeyInfo to the public key values.
RSAKeyInfo.Modulus = text
RSAKeyInfo.Exponent = Exponent
'Import key parameters into RSA.
**** RSA.ImportParameters(RSAKeyInfo)
'Create a new instance of the RijndaelManaged class.
Dim RM As New RijndaelManaged()
'Encrypt the symmetric key
EncryptedSymmetricKey = RSA.Encrypt(RM.Key, False)
txtPublicKey.Text = EncryptedSymmetricKey.ToString
End Sub
End Class
atul sharma 5126
9-Apr-14 12:55pm
View
Thanks for immediate response.
atul sharma 5126
20-Mar-14 7:14am
View
Thanks for the reply.
But my connection string calling is working perfectly in main form.
The issue is coming in the inherited form. The possible reason may be inheriting of a non-form value (from app.config) being part of the mother form.
But i don't know how to get over it.
atul sharma 5126
14-Mar-14 7:16am
View
drop down list named ddldate in which i am listing the dates fetched from sql to datatable
atul sharma 5126
7-Mar-14 11:34am
View
Thanks Phil. It removed the message. But similar message is now showing in following line:
tmpHash = ByteArrayToString(tmpHash)
I tried similar solution in the second function but did not work.
atul sharma 5126
7-Mar-14 4:37am
View
Thanks for the guidance
atul sharma 5126
7-Mar-14 3:36am
View
hi sohail. Thanks for the reply.
The varmode is a variable i have created based on users selection.
The issue is coming when we enter the grid. The first column itself is the combobox with dropdown. The dropdown works but on trying to make selection through arrow the selection moves to row number 2 column 1.
If i come again to row1,column1 then their is no issue.
So, the problem lies between the enter events of grid and cell.
atul sharma 5126
28-Feb-14 7:29am
View
Thanks again SA. I could'nt understand your solution at that time. tried it again and resolved. Exception was generated in the current cell changed event on coming to it twice. Why? I don't know. I shifted my selection code to Cell Enter event and the issue resolved.
Thanks
atul sharma 5126
23-Feb-14 4:38am
View
thanks a lot pete
atul sharma 5126
18-Feb-14 9:16am
View
Strange. the case of being dbnull is not activated. i.e. the Then command of If is jumped over. what may be wrong in this code:
If Row.Cells(favcadr.Index) Is DBNull.Value Then
Row.Cells(favcadr.Index).Value = ""
End If
atul sharma 5126
18-Feb-14 9:03am
View
First time: Blank cell = Nothing
Second time: Blank cell = DBNull
atul sharma 5126
18-Feb-14 6:37am
View
I tried checking string.isNullOrEmpty but that changed the error to : "Conversion from type DBNull to type string is not valid
atul sharma 5126
18-Feb-14 6:18am
View
Dear Bernhard,
You are right. The value of blank column of grid is Nothing, as i have found out in immediate window at first time insertion.
But at the time of second insertion as soon as we refer to the blank cell the said error appears.
atul sharma 5126
18-Feb-14 6:15am
View
Hello Tadit,
I added the following variables to get exact value i am getting:
vartempdr = Row.Cells(favcadr.Index).Value
vartempcr = Row.Cells(favcacr.Index).Value
And in debugging i found:
On first insertion the blank cells value is Nothing and records are inserted
Whereas in second insertion (at updation) as soon as the command to give value to variable is run, the following error is shown in immediate window..
Step into: Stepping over non-user code 'System.Windows.Forms.DataGridViewRow.Cells.get'
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
atul sharma 5126
18-Feb-14 5:41am
View
Thanks for helping. But same error
atul sharma 5126
18-Feb-14 5:41am
View
Thanks for helping. But same error
atul sharma 5126
16-Feb-14 10:54am
View
you are correct dear. This is the line where one value is dbnull due to logical reasons as 1 of the columns in grid is supposed to be left blank and moved on to next column by tab. But the same procedure is followed at first time insert also. So why this problem aries only on second insert.
Also, as you can see in my code, i have tried to change the value of cell to 0 in case it is dbnull, but it is not working.
Please suggest some solution of changing value if dbnull.
Thanks for support
atul sharma 5126
15-Feb-14 10:16am
View
Thanks. Was able to run the sql command
atul sharma 5126
14-Feb-14 23:28pm
View
Thanks for the reply. But i am not sure where to use your provided code. Below is my sub. pls suggest.
Try
connection.Open()
Dim DA As SqlDataAdapter = New SqlDataAdapter
DA.SelectCommand = New SqlCommand("Select FAVCD,FAVCA from FAVC , connection)
Dim dtAccountStatement As New DataTable
DA.Fill(dtAccountStatement)
grdAccountStatement.AutoGenerateColumns = False
grdAccountStatement.DataSource = dtAccountStatement
For Each row As DataGridViewRow In grdAccountStatement.Rows
grdAccountStatement.Columns(0).DataPropertyName = "FAVCD"
Next
connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
atul sharma 5126
12-Feb-14 2:14am
View
i tried the following code but does not help. Also, for currentrow is a readonly property and null was not able to be checked. Can you suggest any particular property or a piece of code which i can use to check? Thanks
Try
If Not dgvList.CurrentRow.IsNewRow Then
dgvList.CurrentRow.Selected = True
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
atul sharma 5126
12-Feb-14 1:21am
View
thanks for detail info.
After removing the catch. i was able to trace error at line:
dgvList.CurrentRow.Selected = True
But as i have already filled the datagrid so none of fields is blank. Any further suggestions?
atul sharma 5126
7-Feb-14 4:22am
View
I have entered the code in question. the issue:
*i have a decimal field in database which can also be negative
*i want to show it in datagridviewcolumn without negative sign (i.e. always positive)
hope i have been able to clear the query
atul sharma 5126
6-Feb-14 9:37am
View
the error is now removed by removing the property also from grid design. But the combobox is showing blank. thanks in advance for the support
atul sharma 5126
6-Feb-14 9:29am
View
Tried it but still same error
atul sharma 5126
6-Feb-14 6:31am
View
thanks johan. I have already got it working with For each row ' command
atul sharma 5126
2-Feb-14 23:52pm
View
thanks for the reply. Is is also possible to use 2005 as i have made the application on another laptop using 2005?
atul sharma 5126
31-Jan-14 9:38am
View
In case of similar Insert Command, same error appears but then the records are inserted.
atul sharma 5126
31-Jan-14 9:35am
View
The first time from loop goes smoothly.
On second time the error appears on selecting of
DataGridView1.Rows(i).Cells(0)
The cursor straight away moves to the execute command.
The error appears number of times equal to the number of record rows
And then the message of record not updated
atul sharma 5126
30-Jan-14 12:19pm
View
I am able to insert the data in database by following changes. but after pressing ok on error
For I As Integer = 0 To DataGridView1.Rows.Count - 1
Try
Insert.Parameters(0).Value = DataGridView1.Rows(I).Cells(0).Value
Insert.Parameters(2).Value = DataGridView1.Rows(I).Cells(1).Value
Insert.Parameters(3).Value = DataGridView1.Rows(I).Cells(2).Value
vartemp1 = Insert.ExecuteNonQuery()
atul sharma 5126
30-Jan-14 12:12pm
View
FAGRD was not getting value so i changed the parameters to:
Insert.Parameters.Add(New SqlParameter("@FAGRD", "Y"))
but still the same error
atul sharma 5126
30-Jan-14 11:56am
View
By breakpoint known: even if 1 record is added, the loop is moving twice and each time the exception is generated
atul sharma 5126
30-Jan-14 11:48am
View
The following exception is generated from catch:
Index was out of range. Must be non-negative and less then size of the collection.
Parameter name: index
-------
atul sharma 5126
24-Jan-14 0:51am
View
It worked great in sql.
But not getting incorporated in vb.net
atul sharma 5126
23-Jan-14 23:51pm
View
I Just tried UPDATE COMP SET COMPN = 23 WHERE COMPC =14
AND IT WORKED.
Means the reason is type. Can u guide what it can be?
atul sharma 5126
23-Jan-14 23:42pm
View
No Its Not Working
I ran the following command in direct sql:
UPDATE COMP SET COMPN = A WHERE COMPC = 14
error: Msg 207, Level 16, State 1, Line 1
Invalid column name 'A'
Thanks for the support
atul sharma 5126
23-Jan-14 15:05pm
View
i tried but it didn't worked
atul sharma 5126
23-Jan-14 14:51pm
View
nvarchar length 2
atul sharma 5126
23-Jan-14 14:49pm
View
End Function
atul sharma 5126
23-Jan-14 14:43pm
View
where is the selected text in the combobox which is also the key field in database. I have also added now the return value for message and it is showing not updated
atul sharma 5126
23-Jan-14 14:41pm
View
thanks for reply. COMPC is a nvarchar field of lenght 2 in database. the current data to this field includes 01, 02 etc. i still tried your suggestion but it is giving error of Type Int is not defined
Show More