|
if i took web part on mmy page error occured regarding sql server
but whole application runs on another pc without any error having same sql server configuration
|
|
|
|
|
More details about the errorcode would be helpful, you may need to update the Web.Config file to show the complete error message, look at the customError section for more details, if you can post the more detailed information then maybe I can help..
|
|
|
|
|
Check the sql server connectivity. see machine.config for more details on connectionstring which is used for webparts
|
|
|
|
|
hi all,
i am creating a page in asp.net using c#.To insert the data,i just wrote the sql command for inserting and followed the same for edit and update.
for example..
string myinsertQuery = "insert into DriveUnits(SerialNumber,CorporationID,CorporationDivisionID,HWVersion,DateManufactured) values('" + SrNumber_TBox.Text + "','" + Session["corporationid"] + "','" + CorporationDivisionID + "','" + Hwversion_Tbox.Text + "','" + DateMFD_TBox.Text + "')";<br />
SqlCommand myCommand_insert = new SqlCommand(myinsertQuery);<br />
myCommand_insert.Connection = myConnection;<br />
myCommand_insert.ExecuteNonQuery();<br />
myCommand_insert.Connection.Close();
but instead of writing code in cs file,i just want to call a class
so that wherever we need to insert data,we can just call the class and the functions defined.
i created a class and a function and pass parameters.but it is showin invalid arguments..
plz give ur suggestions on creating a class and its functions.
Thanks in advance,
cheers
sangeet
|
|
|
|
|
not sure i got you..
maybe this is what you want..
Using static method.
public class MyDBMgmt{
public static bool ExecuteSQL(string cmdText)
{
return true;
}
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read here. Thank you.
|
|
|
|
|
Is this ASP.NET 1.0, 1.1, or 2.0 ? What errors are you getting ? You should certainly put all your SQL in a class, so that it's in a seperate layer to the rest of your app, and can be reused as needed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all
i have some code above. I have Some problem when i save this image is type Gif/ JPG so this image show but when i save is PNG is not yet And when i check C:\\demo.Png is Exist and open is ok but on web is not ok. ????
byte[] byImg = objimg.getBytes();
using (MemoryStream objStream = new MemoryStream(byImg))
{
System.Drawing.Image img = System.Drawing.Image.FromStream(objStream);
Bitmap bp = (Bitmap)img;
//Check this image can show
bp.Save("C:\\demo.Png", System.Drawing.Imaging.ImageFormat.Png);
// Show image
bp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
}
|
|
|
|
|
Problem is the format of PNG is not compatible with the Response.OutputStream method directly, you need to store the image in a memorystream at then send that to the browser...
System.IO.MemoryStream memStream;
byte[] bytBuffer;
Response.Clear();
Response.ContentType = "image/png";
memStream = new System.IO.MemoryStream();
bp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
bytBuffer = memStream.ToArray();
Response.OutputStream.Write(bytBuffer, 0, bytBuffer.Length);
Response.End();
My C++ skills not good, this is a translation of the VB.NET code that I use..
|
|
|
|
|
Hello all:
I have some question and would like your help.
I have created a page call Login.aspx-The user will login from here.
If login successfully, the user will directed to default.aspx which is my main page.
What I like to accomplish is to have the name of previous logged in person from login.aspx page and display his/her name on the default.aspx page.
How do I go about doing this??
Thank you in advance for your help.
eyungwah
|
|
|
|
|
Use cookies for this kind of problem. Save the user name in cookie on login.aspx on successfull login then redirect. And onload event of login.aspx retrieve the value from cookie
FIRE
|
|
|
|
|
You could store the username in a session variable and then display that information..
<%=Session("Username")%>
|
|
|
|
|
Developing a simple service request form with in an intranet...and I need the form to identify the user and automatically fill in the Sent From field when the user submits a request via email from a asp.net 2.0 webform. Please guide me in the right direction.
Thank you.
|
|
|
|
|
Need more information,
1) Do you have a source for the email information available
2) Does each user have a unique identification
With this information it may be possible to find a solution.
|
|
|
|
|
Their login ID should be unique identifier and email address is provided by exchange server.
|
|
|
|
|
I get an "http/1.0 425 http Error" when i try the create a web service using Visual Studio 2003. I have IIS installed and started.
I go to File -> New-> Projects->C# Projects - > ASP.NET web service.
I click 'ok', then i get the above error. Researched it on the web but cannot find a solution get beyond this point.
Anyone know about this?
|
|
|
|
|
i am geeting this error. I am using vb.net 2005 on windows server 2003.
Unable to start debugging on the web server.
when running my asp.net pages with iis.
I checked my iis, it was showing -
Default web site(Stopped)
I tried to start it by right-click the default web site, and Restart.
It did not start teh IIS
I went to the command prompt, and run iisreset
the is still showing stopped
pls help
t.aransiola
|
|
|
|
|
Can you look at the event log ? Is there any error related to W3C service or IIS?
|
|
|
|
|
Also did you enable Windows Authentication for the website?
|
|
|
|
|
Windows Authentication was enabled on the IIS.
This has not solve the problem.
Can i develop my asp.net pages using the File System instead of IIS when done, now create a virtul directory from IIS. I dont know whether this approach has any drawbacks
pls anyone with a solution should help
t.aransiola
|
|
|
|
|
I have a custom server control that behave like an image button and a image map. I implement both IPostBackDataHandler and IPostBackEventHandler interface. I place Page.ClientScript.GetPostBackEventReference(MycontrolID, "") on the page's Page_Init() subroutine. I also code all the javascript function. On my test page, I have my custom control and a button. When I click my custom control, my RaisePostBackEvent gets call properly and I got the correct argument passed in from postback. However, when I put my custom control on the content page along with 10 other button and image button, my RaisePostBackEvent no longer get call. Even though my viewstate and control state continues to get process properly. I do not understand why. Can anyone help me ? I have been stuck on this for a week.
Source code for control
Namespace CustomControls
Public Class TooltipImageButton
Inherits WebControl
Implements IPostBackDataHandler
Implements IPostBackEventHandler
Public Event TooltipImageButtonClick As EventHandler(Of TooltipImageButtonEventArgs)
Protected m_hotSpots As ImageHotSpotCollection
Protected m_imageUrl As String
Public Property ImageUrl() As String
Get
Return m_imageUrl
End Get
Set(ByVal Value As String)
m_imageUrl = Value
End Set
End Property
Public Sub New()
m_hotSpots = New ImageHotSpotCollection
m_imageUrl = ""
End Sub
Public Sub AddHotSpot(ByVal hotSpot As ImageHotSpot)
Try
m_hotSpots.Add(hotSpot)
Catch ex As Exception
End Try
End Sub
Public Function GetHotSpot(ByVal i As Integer) As ImageHotSpot
If m_hotSpots.Count < 1 Then
Return Nothing
Else
Return m_hotSpots.Item(i)
End If
End Function
Public Function GetHotSpot(ByVal id As String) As ImageHotSpot
If m_hotSpots.Count < 1 Then
Return Nothing
Else
Return m_hotSpots.Item(id)
End If
End Function
Public Function HotSpotCount() As Integer
Return m_hotSpots.Count
End Function
Public Sub clear()
m_hotSpots.Clear()
End Sub
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
MyBase.OnInit(e)
End Sub
'***********************************************************************************
'IPostBackDataHandler methods - Get call first
'***********************************************************************************
' Return true if the server control's state changes as a result of the postback; otherwise, false.
Public Overridable Shadows Function LoadPostData(ByVal postDataKey As String, _
ByVal postCollection As System.Collections.Specialized.NameValueCollection) _
As Boolean Implements IPostBackDataHandler.LoadPostData
Dim presentValue, postedValue As String
postedValue = postCollection(postDataKey)
Return True
End Function
Public Overridable Shadows Sub RaisePostDataChangedEvent() _
Implements IPostBackDataHandler.RaisePostDataChangedEvent
End Sub
'***********************************************************************************
'IPostBackEventHandler methods - Get call after RaisePostDataChangedEvent()
'***********************************************************************************
Public Sub raisepostbackevent(ByVal eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent
Dim i As Integer
Dim str, strArgument As String
Dim controlEvent As New TooltipImageButtonEventArgs()
'strArgument = eventArgument
strArgument = Page.Request("__EVENTTARGET")
If strArgument <> Me.ID Then Return
strArgument = Page.Request("__EVENTARGUMENT")
i = strArgument.IndexOf(",")
If i < 1 Then Return
str = strArgument.Substring(0, i)
controlEvent.x = Convert.ToInt32(str)
str = strArgument.Substring(i + 1)
controlEvent.y = Convert.ToInt32(str)
If controlEvent.x < 0 Then controlEvent.x = 0
If controlEvent.y < 0 Then controlEvent.y = 0
RaiseEvent TooltipImageButtonClick(Me, controlEvent)
End Sub
'***********************************************************************************
'Control State methods - Get call after raisepostbackevent()
'***********************************************************************************
Protected Overrides Function SaveControlState() As Object
Return m_hotSpots
End Function
Protected Overrides Sub LoadControlState(ByVal savedState As Object)
If (savedState Is Nothing) Then
Return
End If
m_hotSpots = CType(savedState, ImageHotSpotCollection)
End Sub
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
Page.RegisterRequiresControlState(Me) 'Need this line to load/save control save
If Not Page.ClientScript.IsClientScriptIncludeRegistered("ImageTooltip") Then
Page.ClientScript.RegisterClientScriptInclude("ImageTooltip", Page.ResolveClientUrl("~/ClientScripts/ImageTooltip.js"))
End If
End Sub
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim hotspot As ImageHotSpot
Dim i As Integer
writer.AddAttribute("onload", "javascript:return SetID('" & Page.Form.ClientID & "','" _
& Me.ClientID & "','" & Me.ID & "')")
'Custom postback javascript that will call: __doPostBack(eventTarget, eventArgument) via postBack(event)
writer.AddAttribute("onclick", "javascript:return postBack(event)")
writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "hand")
writer.AddAttribute(HtmlTextWriterAttribute.Width, Me.Width.ToString)
writer.AddAttribute(HtmlTextWriterAttribute.Height, Me.Height.ToString)
writer.AddAttribute(HtmlTextWriterAttribute.Src, Page.ResolveClientUrl(Me.ImageUrl))
writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
writer.AddAttribute(HtmlTextWriterAttribute.Name, Me.UniqueID)
writer.AddAttribute("visible", Me.Visible.ToString)
writer.AddAttribute(HtmlTextWriterAttribute.Usemap, "#MapID")
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0")
writer.AddAttribute("runat", "server")
writer.RenderBeginTag(HtmlTextWriterTag.Img)
writer.AddAttribute(HtmlTextWriterAttribute.Id, "MapID")
writer.AddAttribute(HtmlTextWriterAttribute.Name, "MapID")
writer.RenderBeginTag(HtmlTextWriterTag.Map)
Try
For i = 0 To m_hotSpots.Count - 1
hotspot = m_hotSpots.Item(i)
If hotspot.Show Then
writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "hand")
writer.AddAttribute("shape", "circle")
writer.AddAttribute(HtmlTextWriterAttribute.Coords, hotspot.CenterPoint.x & "," & hotspot.CenterPoint.y & "," & hotspot.Radius)
writer.AddAttribute("onmouseover", "javascript:return MouseOver('" & hotspot.Tooltip & "')")
writer.AddAttribute("onmouseout", "javascript:return MouseExit()")
writer.RenderBeginTag(HtmlTextWriterTag.Area)
writer.RenderEndTag()
End If
Next
Catch ex As Exception
End Try
writer.WriteEndTag("map")
End Sub
End Class
Public Class TooltipImageButtonEventArgs : Inherits EventArgs
Protected m_x As Integer
Protected m_y As Integer
Public Sub New()
m_x = 0
m_y = 0
End Sub
Public Sub New(ByVal x As Integer, ByVal y As Integer)
m_x = x
m_y = y
End Sub
Public Property x() As Integer
Get
Return m_x
End Get
Set(ByVal Value As Integer)
m_x = Value
End Set
End Property
Public Property y() As Integer
Get
Return m_y
End Get
Set(ByVal Value As Integer)
m_y = Value
End Set
End Property
End Class
End Namespace
Rookie Programmer
|
|
|
|
|
Hi, I am indeed got stuck in this ajax. All I want to do is to update the modalpopup label and textfield values when user click on the ok button. Although, my modalpopup works but when I
re-click to open the modalpopup the values don't get updated. Below are my codes, can somebody please really help me. I appreciate
Thanks
<<asp:linkbutton id="LinkButton1" runat="server">>LinkButton<>
<<ajaxtoolkit:modalpopupextender id="ModalPopupExtender1" runat="server"
="" targetcontrolid="LinkButton1" popupcontrolid="Panel1" okcontrolid="btnOk" cancelcontrolid="btnCancel">>
<<asp:panel id="Panel1" runat="server">>
<<asp:updatepanel id="UpdatePanel1" runat="server">>
<<contenttemplate>>
<<asp::label id="Label1" runat="server">>Label<>
<<asp:textbox id="TextBox1" runat="server">>TextBox<>
<>
<<triggers>><<asp:asyncpostbacktrigger controlid="btnOk" eventname="Click">> <>
<>
<<asp:button id="btnOk" runat="server" text="OK" onclick="btnOk_Click">>
<<asp:button id="btnCancel" runat="server" text="Cancel">>
<>
//protected void btnOk_Click(object sender, EventArgs e)
//{
// this.TextBox1.Text = "textfield change";
// this.Label1.Text = "label change";
// }
|
|
|
|
|
do not declare the OkControlID ="btnOk" in the modalpopup.
|
|
|
|
|
Hi, I am indeed got stuck in this ajax. All I want to do is to update the modalpopup label and textfield values when user click on the ok button. Although, my modalpopup works but when I
re-click to open the modalpopup the values don't get updated. Below are my codes, can somebody please really help me. I appreciate
Thanks
<asp:linkbutton id="LinkButton1" runat="server">LinkButton
<ajaxtoolkit:modalpopupextender id="ModalPopupExtender1" runat="server"
="" targetcontrolid="LinkButton1" popupcontrolid="Panel1" okcontrolid="btnOk" cancelcontrolid="btnCancel">
<asp:panel id="Panel1" runat="server" height="185px" width="195px"> --%>
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:label id="Label1" runat="server">Label
<asp:textbox id="TextBox1" runat="server">TextBox
<triggers><asp:asyncpostbacktrigger controlid="btnOk" eventname="Click">
<asp:button id="btnOk" runat="server" text="OK" onclick="btnOk_Click">
<asp:button id="btnCancel" runat="server" text="Cancel">
protected void btnOk_Click(object sender, EventArgs e)
{
this.TextBox1.Text = "textfield change";
this.Label1.Text = "label change";
}
|
|
|
|
|
I need help in adding a hyperlink to a column dynamically using a gridview in asp.net. This is the code that I have now. It displays three columns populated with data and i want to hyperlink the name column that is created in the program.
Dim _Table As New DataTable
Dim _Row As DataRow
'Create the columns
Dim _seopName As New DataColumn("Name", GetType(String))
Dim _seopType As New DataColumn("Type", GetType(String))
Dim _key As New DataColumn("Key", GetType(String))
'Add the columns to the DataTable's Columns collection
_Table.Columns.Add(_seopName)
_Table.Columns.Add(_seopType)
_Table.Columns.Add(_key)
Dim seopname As String
Dim seoplname As String
Dim seopkey As String
Dim seoptyp As String
Dim sifld1 As Integer
Dim sifld2 As Integer
Dim sifld3 As Integer
Dim sifld4 As Integer
Dim seopConn As String = GIS.Common.GISGlobal.GetKey("seopconn")
If mRecordset.Count > 0 Then
If mRecordset.MoveFirst Then
sifld1 = lay.ReturnFieldIndex(mRecordset, seopConn & "FNAME")
sifld2 = lay.ReturnFieldIndex(mRecordset, seopConn & "LNAME")
sifld3 = lay.ReturnFieldIndex(mRecordset, seopConn & "KEY")
sifld4 = lay.ReturnFieldIndex(mRecordset, seopConn & "SUB_TYPD")
Do While Not mRecordset.EOF
_Row = _Table.NewRow
seopkey = Trim(mRecordset.Fields.FieldValueAsString(CLng(sifld4)))
_Row("type") = seopkey
seopname = Trim(mRecordset.Fields.FieldValueAsString(CLng(sifld1)))
seoplname = Trim(mRecordset.Fields.FieldValueAsString(CLng(sifld2)))
_Row("Name") = seopname & " " & seoplname
seoptyp = Trim(mRecordset.Fields.FieldValueAsString(CLng(sifld3)))
_Row("Key") = seoptyp
'Updated for Map It option
_Table.Rows.Add(_Row)
mRecordset.MoveNext()
Loop
End If
End If
Dim sReport As New DataTable
'Create the columns
Dim _sName As New DataColumn("Name", GetType(String))
Dim _sType As New DataColumn("Type", GetType(String))
Dim _sKey As New DataColumn("Key", GetType(String))
'Add the columns to the DataTable's Columns collection
sReport.Columns.Add(_sName)
sReport.Columns.Add(_sKey)
sReport.Columns.Add(_sType)
Dim mReport As DataView
mReport = _Table.DefaultView
'for Map It option
If mReport.Count = 0 Or mReport.Count < 0 Then
litReport.Text = "No Records Found for Sexual Predator/Offender Buffer Map."
litReport.Visible = True
gd_seop.Visible = False
Else
'Add Row for GOB records
litReport.Visible = False
' dvReport.RowFilter = "Source" & "='LSCHOOLS'"
gd_seop.DataSource = mReport
gd_seop.DataBind()
gd_seop.Visible = True
'Print Option
' _GISBasePage.MapParameter.ReportTable = showReport
End If
End If 'IF
|
|
|
|
|
Will there always be a hyperlink and it is just a matter of what the link points to? If that is the case you just need to do some custom binding using a Templatefield with a hyperlink control. You can bind the hyperlink properties to the correct values from your data table. Anyway hope that helps.
Ben
|
|
|
|