|
Post your Question in the Suitable Forum.
SSK.
|
|
|
|
|
select top 5 * from table
use above query .it will work...
Mohammad Mustafa
|
|
|
|
|
hi friends
this is my stored procedure
CREATE procedure dbo.sp_ins_logo
@companyname varchar(120),
@country varchar(80),
@url varchar(150),
@category varchar(80),
@description varchar(250),
@picturepath varchar(80),
@picturetype char(5),
@status int,
@ins_status varchar(10) output,
@lcode varchar(10) output
as
set nocount on
begin transaction
declare @logo_rowid decimal
declare @logo_code varchar(10)
declare @logo_rowcount decimal
declare @max_logoid decimal
declare @logo_codepfix char(3)
set @logo_codepfix='LGO'
select @logo_rowcount= (select count(*) from dbo.tbladdlogos1)
if @logo_rowcount = 0
begin
select @logo_rowid = 1
select @logo_code = @logo_codepfix + convert(varchar(5),@logo_rowid)
end
else
begin
select @max_logoid = (select max(row_id) from dbo.tbladdlogos1)
set @logo_rowid = @max_logoid + 1
set @logo_code = @logo_codepfix + convert(varchar(5),@logo_rowid)
end
declare @file_name varchar(80)
set @file_name = @picturepath + @logo_code + '.' + @picturetype
if not exists (select companyname from dbo.tbladdlogos1 where url = @url)
begin
if not exists (select companyname from dbo.tbladdlogos1 where companyname = @companyname)
begin
insert into dbo.tbladdlogos1 values(@logo_rowid,@logo_code,@companyname,@country,@url,@category,@description,@file_name,@status)
declare @ER as int
select @ER = @@error
if @ER <> 0
begin
set @ins_status='Failure'
set @lcode=@logo_code
end
else
begin
set @ins_status='Success'
set @lcode=@logo_code
end
end
end
commit
GO
this is my codebehind
Try
Dim companyName, categoryName, countryName As String
Dim url, description, other, inFilename, fileType, path, ccategory As String
Dim status As Integer
companyName = txtcompany.Text
ccategory = txtcategory.Text
countryName = ddcountry.SelectedItem.Text
status = 0
url = txturl.Text
description = txtdescrip.Text
path = "images\logos\country\"
inFilename = myFile.PostedFile.FileName
fileType = inFilename.Substring((inFilename.IndexOf(".")) + 1, ((Len(inFilename)) - inFilename.IndexOf(".")) - 1)
strConnString = obj.GetConnectionString()
conn = obj.GetDbConnection(strConnString)
' create a sql comman using the query string and the DBconnection
myCommand = New SqlCommand("sp_ins_logo", conn)
myCommand.CommandType = CommandType.StoredProcedure
Dim objParam As SqlParameter
objParam = myCommand.Parameters.Add("@companyname", SqlDbType.VarChar, 120)
objParam.Direction = ParameterDirection.Input
objParam.Value = companyName
objParam = myCommand.Parameters.Add("@country", SqlDbType.VarChar, 80)
objParam.Direction = ParameterDirection.Input
objParam.Value = countryName
objParam = myCommand.Parameters.Add("@url", SqlDbType.VarChar, 150)
objParam.Direction = ParameterDirection.Input
objParam.Value = url
objParam = myCommand.Parameters.Add("@category", SqlDbType.VarChar, 80)
objParam.Direction = ParameterDirection.Input
objParam.Value = ccategory
objParam = myCommand.Parameters.Add("@description", SqlDbType.VarChar, 250)
objParam.Direction = ParameterDirection.Input
objParam.Value = description
objParam = myCommand.Parameters.Add("@picturepath", SqlDbType.VarChar, 80)
objParam.Direction = ParameterDirection.Input
objParam.Value = path
objParam = myCommand.Parameters.Add("@picturetype", SqlDbType.Char, 5)
objParam.Direction = ParameterDirection.Input
objParam.Value = fileType
objParam = myCommand.Parameters.Add("@status", SqlDbType.Int)
objParam.Direction = ParameterDirection.Input
objParam.Value = status
objParam = myCommand.Parameters.Add("@ins_status", SqlDbType.VarChar, 10)
objParam.Direction = ParameterDirection.Output
objParam = myCommand.Parameters.Add("@lcode", SqlDbType.VarChar, 10)
objParam.Direction = ParameterDirection.Output
myCommand.ExecuteNonQuery()
Dim insStatus, insCode As String
insStatus = myCommand.Parameters("@ins_status").Value
insCode = myCommand.Parameters("@lcode").Value
If insStatus = "Success" Then
Dim statusOutput As String
If statusOutput = "Success" Then
lblMsg.Visible = True
lblMsg.ForeColor = Color.DarkGreen
lblMsg.Text = "Your Logo was uploaded successfully."
Else
Dim delQuery As String
delQuery = "delete from tbladdlogos1 where logo_code='" & insCode & "'"
myCommand = New SqlCommand(delQuery, conn)
myCommand.ExecuteNonQuery()
lblMsg.ForeColor = Color.Red
lblMsg.Text = statusOutput
End If
ElseIf insStatus = Nothing Then
lblMsg.ForeColor = Color.Red
lblMsg.Text = "Problem in uploadig your Logo, Please Try again Later..!"
Else
lblMsg.ForeColor = Color.Red
lblMsg.Text = "you have already uploaded the logo for this comapny"
End If
Catch ex As Exception
Response.Write(ex.Message)
Finally
If (Not conn Is Nothing) Then
' objCsDataBase.CloseDbConnection(conn)
End If
End Try
End Sub
my problem is:
I have four texboxs
1.company name
2.url
3.category
4.description
5.fileupload
here ,i wrote the storedprocdure the users entered the company one time only
next time he entered same comapany the "you have already uploaded the logo for this comapny" this text is displayed
but i entered next time i got error like this
"Cast from type 'DBNull' to type 'String' is not valid"
plz help me
regards
saravanan
|
|
|
|
|
the value (which can be also NULL) from the database to a function, which accepts a string, then you will get such an error.
Cast from type 'DBNull' to type 'String' is not valid.
To get this working you will have to pass the value as an object. That means the function must simply accept it as an object instead of a string.
SSK.
|
|
|
|
|
sorry
i didn't understand
regards
saravanan
|
|
|
|
|
Try to set the Break points and check whether you get the value from the DB or it is null.
SSK.
|
|
|
|
|
break point skip this line
insStatus = myCommand.Parameters("@ins_status").Value
regards
saravanan
|
|
|
|
|
I want the client to be able to drag and drop thumbnail images in the context of the web page
can it is possible ?
waiting for hopfully reply...
|
|
|
|
|
its possible.
you can try ajaxcontrol toolkit in ajaxasp.net
or
you can write your own code for drag and drop of the div elements.
images must be with in the div element.
search the web for div drag and drop. you will get lot of resources for it.
All The Best
Sathesh Pandian
|
|
|
|
|
Hi all,
Can any one plz tell me how to convert a Aspx page into Ajax enabled page.
I have installed the Ajax framework.I have even tried it adding the tag <sript manager="">
|
|
|
|
|
Just u have to need to change webconfig file.
copy webconfig file of AjaxEnable application and paste it in ASPX page application
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Thanks a lot will try this..
|
|
|
|
|
you have to add some configuration tags in web.config. Thats little risky to check it out each and everything.
So what you have to do is, open an ajax enabled website, then copy the content from web.config of the ajax-enabled website and paste it in your application's web.config.
Hope this will work
Regards,
Sylvester G
If we don't succeed, we run the risk of failure
|
|
|
|
|
Hi Friends,
I have a Folder in root directory of my application "MeetingID"
Now i want to create a Folder ("Referance") in the above Folder;How can i do this at code behind ?????
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
Directory.CreateDirectory(YourDirectoryName)
|
|
|
|
|
Thanks
Go the Solution,
Actually i was doing the same but i did not specified the Directory name.
Anyways Thanx.
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
Hi all
I need to Enable & disable AutopostBAck at client side.
Iam using this code but is not working:
<br />
'On code behind page<br />
ddlBusinessLinesL1.Attributes.Add("onchange", "javascript:return DisableBLPostBack('" & ddlBusinessLinesL1.ClientID & "','" & ddlReportType.ClientID & "')")<br />
<br />
'the javascript<br />
function DisableBLPostBack(ddlb,rpType)<br />
{<br />
var ddlbus=document.getElementById(ddlb);<br />
var ddl=document.getElementById(rpType);<br />
alert(ddlbus.id);<br />
if (ddl.value==1)<br />
{<br />
alert('false');<br />
return false;<br />
}<br />
else <br />
{<br />
alert('true');<br />
return true;<br />
} <br />
}<br />
Any help, this is urgent for me.
|
|
|
|
|
What type of alert are you geting true or false ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
All alerts are correct in both cases. But even when returning true it is not posting back. On design i set Autopostback =true.
|
|
|
|
|
That's the problem make Drop down auto post back true initially
Check the attribute of the drop down Autopostback it should be true
There is no meaning in making auto post back true at server side
As it will not go to server
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
That's the problem make Drop down auto post back true initially.
I did.
Check the attribute of the drop down Autopostback it should be true
It is true.
There is no meaning in making auto post back true at server side
I didnt get you!!!!
Thanks
|
|
|
|
|
use onclick event instead of onchange
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
If i use onclick it is posting in both cases
Any other idea..
|
|
|
|