|
Go through this site. You can add and encrypt the connection strings:
Encrypting Connection Strings
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Thanks for the solution it worked fi9
|
|
|
|
|
The ConfigurationManager class has functionality that would allow you to load the configuration file, target the section that has the connection string (typically, ConnectionStrings or AppSettings), modify the connectionstring and then save back. You will need to import System.Configuration namespace.
|
|
|
|
|
I need to validate a URL. At present, I'm using a regular expression, (http(s)?://((w{3})+\.)+([\w-]+\.)+(\w{2,4})+(/[\w- ./?%&=]*)?)|((w{3})+\.)+([\w-]+\.)+(\w{2,4})+(/[\w- ./?%&=]*)?
This Validation expression will work fine only when the URL is in full, like for eg: http://www.abc.com.
There are cases where the url can't have www. In that case, this expression will throw error. For eg: http://forums.microsoft.com. So how to modify the above url? Can anybody please provide any help on this?
Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
|
Just break it into scheme (protocol) and host.
Scheme is everything before ://
Host is everything after :// and before first / (or \)
Path, file, arguements is everything from first / on.
e.g. http://microsoft.com:80/path/file?arg1=1&arg2=2
scheme = "http"
host = "microsoft.com:80" (actually host:port)
path = "/path/" (some leave off trailing /)
file = "file"
args = "arg1=1&arg2=2"
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
I want to upload an image to sqlserver, i use fileupload control and upload the image.
But when I retrieve it to gideview it appears as a text: System.Byte[]
How can i solve this problem..
thanks
|
|
|
|
|
I always say that it is better to store the file location of the image in your database rather then the actual image. This means that your database doesnt become bloated and at the same time you can retrieve the image in almost the same way.
|
|
|
|
|
Could you explaine more what you mean.
Im using the following code to upload the file is there any mistake.
Dim imageBytes(FileUpload1.PostedFile.InputStream.Length) As Byte
FileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)
myCommand.Parameters.AddWithValue("@ImageData", imageBytes)
thanks
|
|
|
|
|
Have u Tried this...
FileUpload1.FileBytes;
|
|
|
|
|
|
Hi,
I am using VS 2005, SQL Server 2005 in windows XP. I wanted to used all these in windows vista
anybody please tell me which windows version is better for .Net developers.
thanks
Ramana
Ramana
|
|
|
|
|
Ramana. G.V wrote: Subject: Which windows vista version is better for .net developer
How many versions are there?
Ramana. G.V wrote: anybody please tell me which windows version is better for .Net developers.
I think most people in this forum would recommend anything over Vista.
|
|
|
|
|
These are the versions
1) Vista Home Basic
2) Vista Home Premium
3) Business
4) Ultimate
which version is better?
Ramana
|
|
|
|
|
I'm not sure that it makes a huge amount of difference which version you choose. I have worked on a variety of OPs and found that VWD or Visual Studio performs fine on most.
If you have a slow machine obviously this will cause a problem.
|
|
|
|
|
XP
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I am using Vista Ultimate and it is okay. Not great, not bad, just okay ( running it on a machine that is plenty able to handle it ). It all depends on how powerful of a machine you have.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi, when i am exporting gridview data to excel file, i am facing following error.. can any one give idea..why it so like this?
"Control 'GVExcel' of type 'GridView' must be placed inside a form tag with runat=server."
My code is as follows
mypage.aspx
<body> <form id="form1" runat="server"> <div> <asp:GridView ID="GVExcel" runat="server"> </asp:GridView> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div> </form></body>
Mypage.aspx.cs
string connstr = "Data Source=ORG33;Initial Catalog=MYDatabase;User ID=sa;Password=miller";
SqlConnection sqlcon = new SqlConnection(connstr);
sqlcon.Open();
string cmdcnt = "Select top 10 * from ORG_TBL_INDSEEDFirst";
SqlDataAdapter sqlda = new SqlDataAdapter(cmdcnt, sqlcon);
sqlda.Fill(ds);
dt = ds.Tables[0];
GVExcel.DataSource = dt;
GVExcel.DataBind();
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GVExcel.RenderControl(htmlWrite); ---Getting Error here
sqlcon.Close();
G. Satish
|
|
|
|
|
Try as below:
Response.Clear();
Response.AddHeader("content-disposition", "attachment;
filename=FileName.xls");
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi am a beginner in dotnet .Am creating a web application in asp vb.net .First i will tell what i want to accomplish
First i have a page when the user logins in to that site the page will display what all the tasks allocated to him in a datagrid
The datagrid has a check box for each of the rows being displayed.
and outside the datagrid there is a send button.When the user clicks the check box and then clicks the send button these datas must get displayed in the another datagrid which is present in another page.
What i have done in back end for this is:
When i check the check box and click the save button all the details will get inserted into the temp table and inside the temp table i have set a flag when the user checks the check box the flag will turn into "y" and the another datagrid which i want to display all the records will choose only the records where the flag is set to "y"
and the codes for it is as follows:
the SP on button click is as follows:
CREATE PROCEDURE USP_VIEW_TASK_UPDATE
(
@TASK_ID VARCHAR(5),
@TASK_ALLOC_DATE DATETIME,
@PROJ_ID VARCHAR(15),
@SUBMOD_ID VARCHAR(15),
@ACTIVITY VARCHAR(15),
@TASK_CREATE_BY VARCHAR(15),
@TASK_DETAILS VARCHAR(100),
@ASSOC_ID VARCHAR(15),
@SEND CHAR(1)
)
AS
BEGIN
CREATE TABLE UST_VIEW_TASK_TEMP
(
TASK_ID VARCHAR(5),
TASK_ALLOC_DATE DATETIME,
PROJ_ID VARCHAR(15),
SUBMOD_ID VARCHAR(15),
ACTIVITY VARCHAR(20),
TASK_CREATE_BY VARCHAR(15),
TASK_DETAILS VARCHAR(100),
SEND CHAR(1)
)
INSERT INTO UST_VIEW_TASK_TEMP VALUES
(
@TASK_ID,
@TASK_ALLOC_DATE,
@PROJ_ID,
@SUBMOD_ID,
@ACTIVITY,
@TASK_CREATE_BY,
@TASK_DETAILS,
@SEND
)
SELECT
ALLO.TASK_ID,
ALLO.TASK_ALLOC_DATE,
HIST.PROJ_ID,
HIST.SUBMOD_ID,
HIST.ACTIVITY,
HIST.TASK_CREATE_BY,
ALLO.TASK_DETAILS,
'N'
FROM
UST_TASK_ALLOCATION ALLO,
UST_TASK_HISTORY HIST
WHERE
ASSOC_ID =@ASSOC_ID
AND convert(varchar,ALLO.TASK_ALLOC_DATE,112) =convert(varchar,getdate(),112)
AND HIST.TASK_ID=ALLO.TASK_ID
AND ALLO.TASK_ID=@TASK_ID
UPDATE UST_VIEW_TASK_TEMP SET SEND='Y'
WHERE
ASSOC_ID =@ASSOC_ID
AND HIST.TASK_ID=ALLO.TASK_ID
AND ALLO.TASK_ID=@TASK_ID
END
and the front end which i havedone on selecting a check box and the button click is:
Dim bsl As New BSL
Dim item As DataGridItem
Dim chkBox As CheckBox
Dim AllocatedDate As String
Dim taskid As String
Dim ProjID As String
Dim SubmodID As String
Dim Activity As String
Dim details As String
Dim CreateBy As String
Dim AssocID As String
Dim Connstr As String = "myconnectionstring"
For Each item In dgUserhometask.Items
chkBox = CType(item.FindControl("chkbox"), CheckBox)
If (chkBox.Checked) Then
AllocatedDate = CType(item.FindControl("lblAllocDate"), Label).Text.ToString
taskid = CType(item.FindControl("lblTID"), Label).Text.ToString
ProjID = CType(item.FindControl("lblPID"), Label).Text.ToString
SubmodID = CType(item.FindControl("lblMID"), Label).Text.ToString
Activity = CType(item.FindControl("lblActivity"), Label).Text.ToString
details = CType(item.FindControl("lblSynopsis"), Label).Text.ToString
CreateBy = CType(item.FindControl("lblAllocatedBy"), Label).Text.ToString
bsl.UserTaskStatus(Connstr, AllocatedDate, taskid, ProjID, SubmodID, Activity, details, CreateBy, AssocID)----->(UserTaskStatus is a function which will call the sp)
End If
Next
Dim ds As DataSet
dgUserhometask.DataSource = ds.Tables(0)
dgUserhometask.DataBind()
End Sub
UserTaskStatus function is as :
Public Function UserTaskStatus(ByVal Connstr As String, ByVal AllocatedDate As String, ByVal taskid As String, ByVal ProjID As String, ByVal SubmodID As String, ByVal Activity As String, ByVal details As String, ByVal CreateBy As String, ByVal AssocID As String) As DataSet
'To get the Connection String
Try
Dim objDataAccess As New DAL(Connstr)
Dim dsViewTask As DataSet
Dim strSQLScript As String = "USP_VIEW_TASK_UPDATE"
Dim strDatabaseServer As String = objDataAccess.DatabaseServer
With objDataAccess
.CreateSQLParmCollection(8)
If AllocatedDate = "" Then
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, DBNull.Value, 1)
Else
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, AllocatedDate, 1)
End If
.AddInParameter("@TASK_ID", SqlDbType.VarChar, taskid, 2)
.AddInParameter("@PROJ_ID", SqlDbType.VarChar, ProjID, 3)
.AddInParameter("@SUBMOD_ID", SqlDbType.VarChar, SubmodID, 4)
.AddInParameter("@ACTIVITY", SqlDbType.VarChar, SubmodID, 5)
.AddInParameter("@TASK_DETAILS", SqlDbType.VarChar, SubmodID, 6)
.AddInParameter("@TASK_CREATE_BY", SqlDbType.VarChar, SubmodID, 7)
.AddInParameter("@ASSOC_ID", SqlDbType.VarChar, AssocID, 8)
dsViewTask = .GetDataSet("USP_VIEW_TASK_UPDATE")
Return dsViewTask
End With
Catch ex As Exception
End Try
End Function
in the second page:
the sp which will be called after button click is:
create procedure USP_USER_VIEW_TASK
(
@ASSOC_ID VARCHAR(30),
@TASK_ID VARCHAR(5)
)
as
begin
SELECT * FROM UST_VIEW_TASK_TEMP
WHERE
SEND='Y'
AND ASSOC_ID =@ASSOC_ID
AND convert(varchar,TASK_ALLOC_DATE,112) =convert(varchar,getdate(),112)
AND TASK_ID=@TASK_ID
END
and the front end coding is for it is:
Dim Connstr As String = "myconnectionstring"
Dim bsl As New BSL
Dim AllocatedDate As String
Dim taskid As String
Dim AssocID As String
AssocID = Convert.ToString(Session.Item("Username"))
Dim dsViewHomeTask As New DataSet
dsViewHomeTask = bsl.ViewHomeTaskStatus(Connstr, AllocatedDate, taskid, AssocID)---->(View Home Task Status is a function which will call the SP)
If (dsViewHomeTask.Tables(0).Rows.Count > 0) Then
dgUpdtasksave.DataSource = dsViewHomeTask.Tables(0)
dgUpdtasksave.DataBind()
lblError.visible = False
Else
lblError.visible = True
dgUpdtasksend.ShowHeader = False
End If
View Home TaskStatus is a sfollows:
Public Function ViewHomeTaskStatus(ByVal Connstr As String, ByVal AllocatedDate As String, ByVal taskid As String, ByVal AssocID As String) As DataSet
'To get the Connection String
Try
Dim objDataAccess As New DAL(Connstr)
Dim dsViewTask As DataSet
Dim strSQLScript As String = "USP_USER_VIEW_TASK"
Dim strDatabaseServer As String = objDataAccess.DatabaseServer
With objDataAccess
.CreateSQLParmCollection(3)
If AllocatedDate = "" Then
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, DBNull.Value, 3)
Else
.AddInParameter("@TASK_ALLOC_DATE", SqlDbType.DateTime, AllocatedDate, 3)
End If
'.AddInParameter("@PROJ_ID", SqlDbType.VarChar, ProjID, 3)
'.AddInParameter("@SUBMOD_ID", SqlDbType.VarChar, SubmodID, 4)
'.AddInParameter("@ACTIVITY", SqlDbType.VarChar, SubmodID, 5)
'.AddInParameter("@TASK_CREATE_BY", SqlDbType.VarChar, SubmodID, 6)
'.AddInParameter("@TASK_DETAILS", SqlDbType.VarChar, SubmodID, 7)
.AddInParameter("@TASK_ID", SqlDbType.VarChar, taskid, 2)
.AddInParameter("@ASSOC_ID", SqlDbType.VarChar, AssocID, 3)
dsViewTask = .GetDataSet("USP_USER_VIEW_TASK")
Return dsViewTask
End With
Catch ex As Exception
End Try
End Function
But when i click the check box and then the save button
its throwing an error "object reference not set to an instance of the object" in the place
If (dsViewHomeTask.Tables(0).Rows.Count > 0) Then
dgUpdtasksave.DataSource = dsViewHomeTask.Tables(0)
in the second page
The second page will show a message if there is no records to display when the user doesnt click the button even that it is not showing its throwing the same error for it .
Can anyone help me in sorting this out
modified on Wednesday, October 29, 2008 3:33 AM
|
|
|
|
|
Sounds like a complex task for a beginner - choose something easier, like working through a book.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Hi graus,
I have to do this and i want a help and not skipping from difficult things if u can help me
|
|
|
|
|
susan_151615 wrote: Catch ex As Exception
End Try
Don't just catch the exception and ignore it. If there is a problem, you won't get any notification about it, and you have no information about what it could be.
Comment out the Try..Catch code until you have got the code working. After that you can reintroduce it, with the addition of actually handling the exception in some way, e.g. displaying a message to the user.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi thank You,
after u mentioned it i wrote in catch
System.Diagnostics.Trace.WriteLine("[] Exception " & ex.Message)
after that i debugged it its throwing an error like this
"Object reference not set to an instance of an object."
in the same line which i entined before
|
|
|
|
|
Did you put that in the ViewHomeTaskStatus method?
The only reference that can be null in the code where you get the exception now, is the data set. It always has a Tables collection, if there was no tables you would get a different exception, and a table always has a Rows collection. So, the conclusion is that a data set is never returned from the method, and that only happens if there is an exception.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|